APEX Tabular Form with [row selector]: How to set value of column in selected rows on submit

Spags picture Spags · Feb 20, 2012 · Viewed 35.1k times · Source

I have a tabular form that displays all requests submitted for processing. Submitters have the opportunity to cancel requests at any time. I would like this to be accomplished by simply checking the row selector checkbox of the row(s) that should be cancelled and clicking submit.

Ok... What I am trying to create is a tabular form that, when the [row selector] checkbox is checked and the form is submitted, the value in the 'Status' column of the row is set as 'Cancelled'.

Since the [row selector] checkboxes exist, my guess is there is probably a built in process of some sort that identifies the selected rows and runs an action on the selected rows.

Is there a way to tap into this functionality and take the extra step to set the value of the 'Status' column of the row to 'Cancelled'?

Answer

NoGotnu picture NoGotnu · Jun 8, 2013

Read my comment on Tom's answer. Example code of process:

declare 
  l_map apex_application_global.vc_map;
  l_region_id number;
begin
  if :APEX$ROW_SELECTOR = 'X' then
    select t.region_id
     into l_region_id
     from APEX_040100.APEX_APPLICATION_PAGE_RPT t
     where t.application_id = :APP_ID
       and t.page_id = :APP_PAGE_ID
       and t.source_type = 'Tabular Form';

    l_map := apex_040100.wwv_flow_tabular_form.get_row_values(
      p_tabular_form_region_id => l_region_id,
      p_row_num => :APEX$ROW_NUM
    );

    update my_table
     set status = 'Cancelled'
     where id = l_map('ID');
  end if;
end;