Reputation:
I want to pass the data from one page (a form) to another without actually adding the data to the database. I will use the 'next' button to pass the values (data) and 'submit' button to insert all the details from previous pages to the database. Does anyone know how can I achieve this in Oracle Apex Pages?
Upvotes: 0
Views: 1079
Reputation: 406
You can use apex collections.
In the first page create a process assigned to your NEXT button where you save your form data to the collection, just like in the example above:
BEGIN
apex_collection.create_or_truncate_collection(p_collection_name => 'FORM_DATA');
apex_collection.add_member( p_collection_name => 'FORM_DATA'
, p_c001 => :P1_ITEM1
, p_c002 => :P1_ITEM2
, p_c003 => :P1_ITEM3
, p_c004 => :P1_ITEM4
, p_c005 => :P1_ITEM5
);
END LOOP;
END;
You can also use p_n001 - p_n005 for numbers and p_d001 - p_d005 for dates as you can read here
In the second page in will need to create a custom process to save your data to DB where you'll need to read the data from the collection, just like the example above:
BEGIN
INSERT INTO my_table (col1, col2, col3, col4, col5, col6, col7, col8, col9, col10)
SELECT c001
, c002
, c003
, c004
, c005
-- 2nd page form items
, :P2_ITEM1
, :P2_ITEM2
, :P2_ITEM3
, :P2_ITEM4
, :P2_ITEM5
FROM apex_collections
WHERE collection_name = 'FORM_DATA'; -- collection name must be uppercase
END;
Upvotes: 0