user1481789
user1481789

Reputation: 49

identify selected checkboxes in apex interactive report

I have an Interactive Report which I'm generating using a collection.

select apex_item.checkbox(1,'obj_name') ' ', col 01, col 02 from apex_collections where collection_name='XYZ';

The table on which this report is being generated has a composite primary key, so when the user selects multiple checkboxes, I'm not able to figure out how to identify which all rows were selected by user. This is because according to my knowledge, through p_value in apex_item.checkbox(p_idx,p_value) I can just pass one column/field/item. But the requirement is to pass both obj_name and col 01 back to the pl/sql code.

To explain it better, I have an on submit process associated to it.

FOR I in 1..APEX_APPLICATION.G_F01.COUNT LOOP DELETE FROM abc WHERE obj_name = (APEX_APPLICATION.G_F01(i)) AND tab_col = col 01; END LOOP;

So how can I send the value of col 01 of the selected checkboxes to the above process is what my question is. Any help would be great.

Upvotes: 0

Views: 7176

Answers (2)

user1481789
user1481789

Reputation: 49

A better approach which I've found now is using rownum as unique value, that actually reduces a lot of logic in my code. Just calling it out.

Upvotes: 1

Drumbeg
Drumbeg

Reputation: 1944

Could you concatenate the obj_name and col_name?

select apex_item.checkbox(1,'obj_name-'||col_01) ' ', from apex_collections where collection_name='XYZ';

Then in the processing section

FOR I in 1..APEX_APPLICATION.G_F01.COUNT LOOP 

    my_object_name := substr( G_F01(i), 1, instr( G_F01(i), '-' ) - 1 );
    my_column_name := substr( G_F01(i), instr( G_F01(i), '-' ) + 1 );

    DELETE FROM abc WHERE obj_name = my_object_name AND tab_col = my_column_name;     

END LOOP;

Upvotes: 0

Related Questions