0
votes

How can I create a 2 page wizard based on 2 database tables with a foreign key from Table 1 to Table 2?

Client Table:

Client_ID, Client_Name

Subscription Plan Table:

Plan_Name, Client_ID

Wizard Page 1:

  • Enter Client name then click next

Wizard Page 2:

  1. Client name visible with value from page 1 as display only
  2. Select Plan Name
  3. Submit > Action should save all the above info in the 2 DB tables

I'm still in the beginning of learning Oracle APEX so please be patient with my ignorance.

I already have the wizard with 2 pages each page with the required forms for table 1 & 2 but can't understand how to pass the data from page 1 to page 2 then submit all at the end.

2

2 Answers

0
votes

Usuallly, in a wizard you don't want to commit data to the actual tables until you have clicked something like 'Finish' somewhere at the end of the wizard. So, be careful of that. You most likely do not want an automated row processing occuring on submit of page 1 and 2.

To store data temporarily you don't have to do any extra work. The keyword is session state here (and you'll deal with it a lot).
In your example you'd have page 1 and page 2 each with 1 page item on them. When you go from page 1 to page 2, you should set it up so clicking the 'Next' button on page 1 will submit the page. You can then branch to page 2 in one of the processing points.
Submitting the page will submit the value of the page items on that page to the session state. This session state of the item is retained in the user's session for as long as it exists and isn't cleared.
This means that when being on page 2 and page 3 you can still access the value of the page item on page 1. For example, by using :P1_CLIENT in a PLSQL process on page 3.
This is ideal for your wizard as you can simply let the user go through each step while at the end simply using the session state of the items on previous pages to process these to the database.

Alternatively, people have been known to put everything in apex collections, which are the alternative to global temporary tables from sql in apex's session state context. I wouldn't use those for single row storage, but if you ever need a multi-line storage in a wizard, these will serve the purpose.

0
votes

You Need to Go through Sample Database Application's Order Process