Using Apex 4.2
Created a Tabular Form based on a view. Removed all the default multi-row updates and deletions, buttons and processes.
I am using a tabular form because of the fact that I can gain access to a row selector.
The row data itself is all read only so in effect this is a report with a row selector.
This is because I can't find a way to select a row an interactive report, well I can and did but this was a work around.
I have created a button to process the selector to run the below code:
begin kdm_adm_utils.log ('Page', 'XKDM: WF: Current Development', 'Selected Check Boxes:'||wwv_flow.g_f01(1)) ; kdm_adm_utils.log ('Page', 'XKDM: WF: Current Development', 'Selected Check Boxes:'||wwv_flow.g_f02(1)) ; for i in 1..wwv_flow.g_f01.count loop kdm_adm_utils.log ('Page', 'XKDM: WF: Current Development', 'i:'||i) ; kdm_adm_utils.log ('Page', 'XKDM: WF: Current Development', 'WF ID:'|| wwv_flow.g_f02 (wwv_flow.g_f01.count)) ; end loop; end;
I just wanted to see what would be output. For one row this works fantastically and I can find the ID based on the row
When I select more than one row the loop run's through for the number of rows but then also runs for the number of rows selected.
So if I selected threee rows this above procedure would run three times, each times looping three times.
I have set the execution scope to: For Created and Modified Rows in the button condition that appears.
I only want to loop through the selected rows once per button click
Know which row I am currently looping through.
Really would appreciate some kind of input here.
I think the built in selector is making your life harder because the information that contains is 1,2,3,4,5. You then need to map 3 to the ID of your 3rd row.
So, if you check row 1 and 3, on submit, the row selector will have two rows, one with value of 1 and with with value of 3.
I would remove the selector, use and ID column that I can change to be Simple Checkbox (or whatever value you can use to uniquely identify it). Or add your own apex_item.checkbox(n, ID) to your SQL.
Then your loop on apex_application.g_f01.count (if that's the checkbox column) will only contain the elements checked and their values will be the ID that are checked.
All that said, here's a useful example from Denes Kubicek
Hope this makes sense
Message was edited by: jrimblas Added link to Denes example page
The problem is not with the loop. It works perfectly. The problem is that it occurs for as many rows as are selected. I worked around the problem with a global variable that I set and make sure to only run the loop once. Bit inefficient but still learning the inner workings of APEX