I have the following select statement that I am using as a standard report:
select id,
name,
telephone,
apex_item.checkbox2(10,id) as "Tick when Contacted",
apex_item.text(20,:P2_DATE) as "Date Contacted",
apex_item.textarea(30,:P2_COMMENT,5,80) as "Comment"
from my_table
My question is and the area that I am not sure if I am doing this correctly is that if this statement returns 10 rows and out of those 10 rows, I only select/check 5 records and then press the submit button, why is it that my PL/SQL page process that inserts the selected records into another table is not picking up :P2_DATE and :P2_COMMENT which are hidden items on the page and purely just used as placeholders and not actual columns within my_table?
Am I doing this correctly or do I need to use an apex collection?
Here is what my page process looks like; is this correct?
DECLARE
v_row BINARY_INTEGER;
BEGIN
FOR i IN 1..APEX_APPLICATION.G_F10.COUNT LOOP
v_row := APEX_APPLICATION.G_F10(i);
INSERT INTO MY_OTHER_TABLE
( DATE_CONTACTED,
COMMENTS
)
VALUES ( APEX_APPLICATION.G_F20(v_row),
APEX_APPLICATION.G_F30(v_row)
);
END LOOP;
COMMIT;
END;
Example of report with user input is as follows:
ID/CHECKBOX DATE CONTACTED COMMENTS
=====================================================
1 21/08/2012 Comment 1
2 21/08/2012 Comment 2
3 21/08/2012 Comment 3
4 21/08/2012 Comment 4
5 21/08/2012 Comment 5
Based on this report where user has manually entered these 5 comments, I expect these 5 records get inserted into MY_OTHER_TABLE, as they have been checked.
Unfortunately MY_OTHER_TABLE never gets populated for the 5 records that I have checked.
I am unsure what I have missed out on something, or if I have completely got my original select wrong with regards to using these two placeholder items?
In your comment you say
Now i read that as:
Yes. You can. That is what i thought you meant originallyn and it makes sense since the items are hidden anyway. Just make sure of the below:
if you meant that the value is not put in the report items at page load:
if the region with the hidden items is BELOW the region with your report, move your region with the items or create a new region ABOVE the region with your report.
With above and below i’m talking about their position in the form structure. Switch over to tree view if you use component view to easily see this.
My guess is that the item (and its source) is processed before, and thus has a valid session state before the rendering of the report starts.