Hello Sir,
I have a requirement to create a Wizard style form in Apex. It is exactly the same as the Order Processing in Sample Database Application.
The change I need is, instead of using APEX_COLLECTION method for the Order Items I need to use Interactive Grid and save the data at the end in the Confirmation page.
So process would be something like Customer Details -> Order Items -> Order Summary -> Confirm Order.
Customer Details = to enter new customer details (Cust_Id is PK - auto generate on Seq)
Order Items = to enter order details (Order_Id is PK, Order_Item_Id is PK - auto generated on Seq)
Order Summary = to view/review current order
Order Confirm = to confirm the current order and To Save data in Customers and Orders/Orders_Details tables respectively.
Would it be possible for you to guide me and provide me the steps ?
Your help is greatly appreciated.
BhavinProfessional
Vinish Kapoor
Hi Bhavin,
You can create a global temporary table to hold the records temporarily in it.
But even I would suggest you create a normal table with one more column, apex_username.
For example, your table structure would be:
You will always empty this table after login by specifying where apex_username = :app_user.
Before running every wizard, you can delete the records for the current order number before populating it.
And when the user confirms, you can simply transfer the data from this temporary table to the actual table and can delete the records from this temporary table at this point too.
The performance also will not impact, because you will always have the current order stored in it.
You will find this a comfortable and straightforward approach.
Please let me know if any doubts.
Bhavin
Hi Vinish Sir,
Many thanks for your prompt reply and providing the guidance to implement wizard steps.
I will update you accordingly.
Bhavin
Hi Vinish,
I have tried the solution as you have suggested but I am struggling in IG. I assume Global Temp Table only works for single entry (not sure) but for multi rows we have to use Apex Collection.
Would it be possible for you to make a demo on this?
Vinish Kapoor
In the first line, I just mentioned the global temporary table, but further, I already suggested you to create a normal table, no global temporary table.
So instead of a global temporary table, create a normal table and manipulate it as I already mentioned above.
Please let me know if any issues.
Bhavin
Hello Vinish sir,
My apologies for not coming back earlier as I was not well. I have implemented the steps as you have mentioned earlier by creating a normal table...I can confirm that it's all working fine with IG on a normal temp table and then inserting data from temp table to actual table.
Many thanks for your all help and support.
Vinish Kapoor
That is great Bhavin and I really appreciate that you always confirm whatever the status is good or bad.
It helps me to understand whether my suggestions are working or not. Thank you very much.
Bhavin
Hello Vinish,
Further to my earlier message everything is working fine except when I click the PREVIOUS button I am losing the Page Item values (especially for FORM page) which I have already entered.
How can I keep the page item values even I do back and forth in wizard?
Your help would be appreciated.
Vinish Kapoor
In the wizard, how are you moving between forms?
I mean, are you just calling another form page using the link method?
If this approach you are using, then you will lose the data already entered.
You should create a Branch to navigate to another form page. Follow these steps:
On your first page, create a button (label Next) to submit the page.
Then click on the Process tab, select the After processing node and do the right-click.
Select the Create Branch option from the shortcut menu.
Then define the name of the branch and in the behavior section, select the type as Page or URL and define the page for the link.
Now when the user clicks on the Next button, the page will submit, and the branch will execute to open the next form.
Use this method for all of your pages. You will not lose the data entered for the items.
Try this and let me know if any issues.
Bhavin
Hello Vinish,
I have implemented the same method for all the pages but when I click the PREVIOUS button and go to previous page I loose the data. I have also created a branch to go to the previous page.
Vinish Kapoor
Ok, then please check that the link target property, cache option is blank or not.
The Clear Cache setting for link must be blank; else, it will clear the page on every visit.
Bhavin
Hi Vinish,
Yes, Cache option is blank. I have also checked the Order Processing wizard on Sample Database Application, that one also doing the same behaviour, cleared out the data. Is there any way not to clear out the data?
My settings for a branch:
Vinish Kapoor
I have just tested, and I didn't find this issue. Item is holding the value when navigating between forms.
I also tested the Sample database application order form, which is also saving the item value.
Actually, when a form submits, it saves the item value for the current session unless it is not being cleared.
In your case, I don't know why it is happening.
Check if any header process is defined in your page.
Bhavin
Hi Vinish,
Many thanks for your prompt reply and providing the instant solution.
I have checked there is no header process in my page.
I think (not sure) the issue is setting the Source of the page item.
By default Wizard does not set the Source for the page item so in Source attribute, Type is set to NULL and Used is set to Only when current value in session state is Null.
And in my case I have set the Type to Database Column and Used is set to Always, replacing any existing value in session state.
Vinish Kapoor
Oh, ok, that is why.
I think you no need to specify the database column as the source. Specify the source as NULL. The values will remain there; you can access them at the end of the wizard.
Farooq Ahmad
My Chanel may be help you
Bhavin
Many thanks Farooq, I will have a look.