Solved

Set FALSE if the value IS NULL.

  • 21 March 2023
  • 3 replies
  • 144 views

Badge +1

Hi,

If I create a new record in the ‘Cost/Revenue Elements’ Window, (TEST15)

Creating a new record in the Cost/Revenue Element Window

That record will appear in the ‘Cost Element Code Part Demand’ window as well.

Exclude from Budget Control’ checkbox is empty when creating this record in the ‘Cost Element Code Part Demand’ window. 

If I check the database, ‘Exclude from Budget Control’ column will be NULL.

I want this column to be ‘FALSE’. so, an event needs to be written to set "Exclude from budget control" value to FALSE if its saved as NULL in Cost Element Code Part Demand tab when a new record is added to this table.

I created an event for the PROJ_C_COST_EL_CODE_P_DEM_TAB


 

and created an Action in the  and called the Modify_ method to do this. 

 

set a Condition to perform this action when the ‘NEW:C_EXCLUDE_FROM_B_C’ IS NULL.

but it seems like this does not do any changes to the database.

 

does anyone know where the issue or any other way to do this.

 

Thanks and Regards.

Ramitha.

 

icon

Best answer by Ramitha_M 22 March 2023, 07:54

View original

3 replies

Userlevel 7
Badge +28

You have to check the box to True, then again to False to get it to show false.

Many binary check boxes behave like this, the default value is NULL and there is no way to set them directly to FALSE after creation, they must first be registered as TRUE, then FALSE, then they will show as you intend.

Badge

He is Right, they must be registered as TRUE, then FALSE.

Badge +1

Hi @ShawnBerk @Richardson69,

This is Resolved now.

I created an Event for the  Project_Cost_ELement Tab. The action will trigger when the user creates a new record and call Modify method for the Proj_C_Cost_El_Code_P_Dem window and pass the value ‘FALSE’ to the desired column.

 

DECLARE
  attr_       VARCHAR2(32000);
  sql_msg_    VARCHAR2(32000);
  stmt_       VARCHAR2(32000);
  job_id_     NUMBER;
  
BEGIN

  stmt_ := '
DECLARE

info_        VARCHAR2(32000);
attr_        VARCHAR2(32000);
objid_       VARCHAR2(32000);
objversion_  VARCHAR2(32000);

CURSOR get_objid IS
select t.objid, t.objversion 
from proj_c_cost_el_code_p_dem t
where t.project_cost_element = ''&NEW:PROJECT_COST_ELEMENT'';

BEGIN

OPEN get_objid;
FETCH get_objid INTO objid_, objversion_;
CLOSE get_objid; 

Client_SYS.Clear_Attr(attr_);
   Client_SYS.Add_To_Attr(''C_EXCLUDE_FROM_B_C'',''FALSE'',  attr_);
   proj_c_cost_el_code_p_dem_API.Modify__(info_, objid_, objversion_, attr_, ''DO'');


COMMIT;
END;';

  sql_msg_ := Message_SYS.Construct('UPD');
  Message_SYS.Add_Attribute(sql_msg_, 'SQL', stmt_);
  Client_SYS.Clear_Attr(attr_);
  Client_SYS.Add_To_Attr('SQL_DATA_', sql_msg_, attr_);
  Client_SYS.Add_To_Attr('MSG_', '', attr_);
  Transaction_SYS.Deferred_Call(job_id_,
                                'Fnd_Event_Action_API.Action_Executeonlinesql',
                                'PARAMETER',
                                attr_,
                                'NULL to FALSE');
END;
 

Reply