Exit_form doesn't work as expected - oracle

I am using exit_form to close a form. But, when I call that form from another form and then press the exit key, it returns to the form which called it.
Example:
if form_a calls form_b. In form_b trigger exit_forms triggers, it will call form_b.
Well, I need to exit all opened form.
thanks

You need to use then new_form statement instead of open_form or call_form:
new_form exits the current form and enters the indicated form. The calling form is terminated as the parent form. If the calling form had been called by a higher form, Oracle Forms keeps the higher call active and treats it as a call to the new form. Oracle Forms releases memory (such as database cursors) that the terminated form was using.Oracle Forms runs the new form with the same Run form options as the parent form. If the parent form was a called form, Oracle Forms runs the new form with the same options as the parent form.NEW_FORM can be instructed to continue the database transaction, rollback to the current save point or perform a full rollback. It can also be instructed to open the new form in query only mode and to share or not share library data.

according to oracle forms help
call_form:
Runs an indicated form while keeping the parent form active. Oracle Forms runs the called form with the same Runform preferences as the parent form. When the called form is exited Oracle Forms processing resumes in the calling form at the point from which you initiated the call to CALL_FORM.
open_form:
Opens the indicated form. Use OPEN_FORM to create multiple-form applications, that is, applications that open more than one form at the same time.
so I suggested to try use open_form with no_active parameter then call exit_form to exit form (A), after form(A) closed the focus will gained by opened form(B).
so you finish working on form(B) and close it, it will exit all your forms.
to simplify :
on form_A on button trigger when_pressed_button (which responsible to open form_B) you can try
OPEN_FORM('form_b', NO_ACTIVATE, NO_SESSION, 'my_parameters');
exit_form(no_validate);

Related

How to find where an Alert is initiated in Oracle Forms 6i?

in a Oracle 6i form, I have an alert defined, and a database block. Because it's a database block, when some data is entered, but not saved, when you try to exit this form, this alert pops up (asking 'Do you want to save this data?'). However, all this happens BY DEFAULT, I don't see any triggers/program units where this alert is called... Also, the text for this alert is also assigned dynamically, and I can't find any triggers/programs where it is being done... What am I missing? Thank you.
I'm not sure you can find it anywhere in Forms Builder; that behavior is built-in, Oracle Forms raises the alert when it finds out that one (or more) database items have been changed, and those changes not saved at the moment you're trying to e.g. exit the form, enter query mode, navigate to another record etc.
In order to prevent changes to be lost (end users would hate it, spending minutes to enter data which is gone without notice), Forms informs you about it and lets you choose whether you want to keep (save) those changes or not.
Therefore, just say "Thank you" every time you see it because those nice people at Oracle did it so that us, developers, wouldn't have to in each and every form we create.

What is the purpose of session.endConversation()

I am developing a bot in node.js using the Microsoft Bot Framework. Once my user has completed their action with my bot; I am calling session.endConversation(). However, I am not sure really what this is doing. My assumption when calling this code would be that it would clear out session data; so if the user interacts with the bot again; they will essentially be starting over.
However, when I call endConversation(), the user data is still there:
session.endConversation("Thank you for your business!");
console.log("User Data:");
console.log(session.userData);
The documentation just says, "ends the conversation" but doesn't describe what in fact that means.
I guess my question is; what is this function doing and when you are finished with a conversation, what should the approach be to handle the users conversation data?
According to this post:
As a result, when a conversation or dialog has come to an end, it’s a best practice to explicitly call endConversation, endDialog, or endDialogWithResult. endConversation both clears the current dialog stack and resets all data stored in the session, except userData. Both endDialog and endDialogWithResult end the dialog, clear out dialogData, and control to previous dialog in the stack. Unlike endDialog, endDialogWithResult allows you to pass arguments into the previous dialog, which will be available in the second parameter of the first method in the waterfall (typically named results).

How to handle multiple asynch downloads

I recently moved my background synch downloads to a view controller and need some advice on how to best handle them asynch. I have written all the code to show a progressview as the download occurs but as you might have guessed it's not that simple. Here's how it works.
user sees a tableview with two entires one for each database. they can press a button to download the database and when the download starts that fires off the asynch URL connection,etc. This works to a certain extent however it's not that simple.
here's what i want it to do.
download the main update URL (works ok)
then download a secondary URL.
then apply the first URL content to the sqlite store (code written for that)
then apply the 2nd URL content to the sqlite store (code written for that)
(All the while showing progress to the user)
when the downloads were synch it was easy as i just waited for them to finish in order to fire the next activity off but when using the asynch method i'm struggling with how to get them to wait. Step 3 depends upon step 1 finishing and step 4 depends on step 2 finishing and overall success relies on all finishing. step 4 needs to wait for step 3 to finish otherwise the database locks will cause a clash.
the second complication is that if the user presses the second button while the first is downloading then steps 3, 4 will clash if they execute at the same time as the first row is accessing the database.
Has anyone done anything similar and if so what was the strategy you used to manage the flow of events.
Also i wanted to wrap this all up in a backgroundTask with ExpirationHandler so it would survive the user pressing the home button... but the delegate methods don't get called when i do that.
Ok Here is what i did to fix the problem.
Created an NSOperationQueue
Added the URL operations as NSURLInnvocationOperations
3.waited until the URL operations were complete (waituntilalloperationsarefinished).
Then set the max concurrent count to 1 which forced the subsequent database operations to execute in series one after the other and thus prevented SQLite from locking it's self out.

Sessions in Codeigniter

I am using sessions to store data from my multi step form so that when the user completes all three sections of the form then the information is inserted in to the database. I have built the form so that the user can go back to any stage and modify the information they have submitted, the thing is though, the values that repopulate the form are stored in sessions so if the user leaves the form page and goes elsewhere in the website and then returns to the form the information is still in the form…is there a better way to do this? I want the data destroyed if they leave the form…
Thanks
Assuming your form exists only in one controller and isn't spread across multiple ones, you could simply unset all session values in the __construct of every other controller. (You could extend the base controller if you have lots to save the hassle of adding this functionality to many.
That way if the user visits another section, the values will be lost, but providing they remain within the "form" they can remain intact.
You could with JavaScript and the unload event, but it'll prove tricky since unload may fire with each "section" of the form.

Developer2000 OPEN_FORM built-in

I am a newbie in Developer2000.
I have an Oracle pl/sql procedure (say, proc_submit_request) that fetches thousands of requests and submits them to dbms_job scheduler. The calling of dbms_job is
coded inside a loop for each request fetched.
Currently, i have a button (say, SUBMIT button) in oracle forms screen clicking which calls proc_submit_request.
The problem here is... the control does not return to my screen untill ALL of the requests fetched are submitted to the dbms_job (this takes hours to complete)
The screen grays out and just the hour-glass appears untill the completion of the procedure proc_submit_request.
proc_submit_appears returns a message to screen telling "XXXX requests submitted".
My requirement now is, once the user clicks the SUBMIT button, the screen should no longer gray out. The user should be able to navigate to other screens and not just struck with the submit screen untill the called procedure is completed.
I suggested running listeners (shell scripts and perl stuff) that can listen for any messages in pipe and run requests as back-ground process.
But the user is asking me to fix the issue in the application rather running listeners.
I've heard a little of OPEN_FORM built-in.
Suppose, I have two forms namely Form-1 and Form-2. Form-1 calls Form-2 using OPEN_FORM.
Now are the following things possible using OPEN_FORM?
On calling open_form('Form-2',OTHER-ARGUMENTS...), control must be in Form-1 (i.e. USer should not know that another form is getting opened) and Form-2 should call proc_submit_request.
User must be able to navigate to other screens in the application. But Form-2 must still be running until proc_submit_procedure is completed.
What happens if the user closes (exits) Form-1 ? Will Form-2 be still running?
Please provide me answers or suggest a good solution.
Good thought on the Form-1, Form-2 scenario - I'm not sure if that would work or not. But here is a much easier way without having to fumble around with coordinating forms being hidden and running stuff, and coming to the forefront when the function actually returns...etc, etc.
Rewrite your function that runs the database jobs to run as an AUTONOMOUS_TRANSACTION. Have a look at the compiler directive PRAGMA AUTONOMOUS_TRANSACTION for more details on that. You must use this within a database function/package/procedure - it is not valid with Forms (at least forms 10, not sure about 11).
You can then store the jobs result somewhere from your function (package variable, table, etc) and then use the built-in called CREATE_TIMER in conjunction with the form level trigger WHEN-TIMER-EXPIRED to go and check your storage location every 10 seconds or so - you can then display a message to the user about the jobs, and kill the timer using DELETE_TIMER.
You could create a single DBMS_JOB to call proc_submit_request. That way your form will only have to make one call; and the creation of all the other jobs will be done in a separate session.

Resources