Skip to content
Home » Questions » Approve all dynamically in oracle apex

Approve all dynamically in oracle apex

Hi Sir,

I have created a lov with Approve All,Reject All.

If i select approve all then all the status field should be approved vice versa dynamically

16 Answer(s) on "Approve all dynamically in oracle apex"

  1. Create a dynamic action on the status LOV for the change event to execute PL/SQL code.

    Then add the following PL/SQL code in it:

    if :px_status_lov = 'APPROVE ALL' then
      Update table1
        set status = 'APPROVED'
      Where yourconditionColumn = :px_column;
      
      Delete from table1
        where yourconditionColumn = :px_column;
    elsif :px_status_lov = 'REJECT ALL' then
      Update table1
        set status = 'REJECTED'
        Where yourconditionColumn = :px_column;
    End if;

    Then create one more True action to refresh the report region below.

      1. What is the return value of the LOV list P3_STATUSALL? I have given the example of APPROVE ALL in capital letters. You need to specify the only value you have defined for the return value.

        In items to submit, why P3_STATUSM? You should specify only P3_STATUSALL and P3_PID.

        1. Return Value of P3_STATUSALL is Approve All & Reject All

          when i click on approve all then  P3_STATUSM value should be approved (and  P3_STATUSM is also a lov containing Approved and Rejected

  2. If the return value of P3_STATUSALL is Approve All then you should change the if condition accordingly. Below is the code:

    if :px_status_lov = 'Approve All' then
    Update table1
    set status = 'APPROVED'
    Where yourconditionColumn = :px_column;
    
    Delete from table1
    where yourconditionColumn = :px_column;
    
    apex_util.set_session_state('P3_STATUSM', 'Approved');
    
    elsif :px_status_lov = 'Reject All' then
    
    Update table1
    set status = 'REJECTED'
    Where yourconditionColumn = :px_column;
    
    apex_util.set_session_state('P3_STATUSM', 'Rejected');
    end if;

    Items to submit: P3_STATUSALL,P3_PID

    Items to return: P3_STATUSM

    1.  

      Same as previous not firing

       

      apex_util.set_session_state('P3_STATUSM', 'Approved');  this is not working but the status field is changing 
  3. It means the dynamic action on the list change event is firing. Because it refreshes the page.

    So you have to check the values returned by the STATUSM and STATUSALL lists. Also, check and update and delete statement if you specified the correct condition.

    1. if :p3_statusall = 'Approve All' then
      Update times
      set statusm = case when statusm is null then 'APPROVED' else statusm end;
      set statust = case when statust is null then 'APPROVED' else statust end;

      Where pid = :p3_pid;
      apex_util.set_session_state('P3_STATUSM', 'Approved');

      elsif :p3_statusall = 'Reject All' then
      Update times
      set statusm = case when statusm is null then 'REJECTED' else statusm end;
      set statust = case when statust is null then 'REJECTED' else statust end;
      Where pid = :p3_pid;
      apex_util.set_session_state('P3_STATUSM', 'Rejected');

      end if;

       

       

      i have multiple fileds to be set approve i.e., 5 days a week(statusm,statust,statusw ...) will this plsql work

        1. Delete the True action to Refresh the region. Instead, create another True action to execute JavaScript code and add the following code in it:

          location.reload();

Leave a Reply