This discussion is archived
11 Replies Latest reply: Jan 15, 2013 8:33 AM by Andreas Weiden RSS

Problem with multiple forms opened in one session

kmocampo Newbie
Currently Being Moderated
Hello, I have a multi forms application, developed with Forms 10.1.2.3.0. I use OPEN_FORM to open, when the user selects an option in the main menu. The user can open as many forms as he wants, and many instances of the same option is also possible. We have control over the global variables, and it works fine almost all the time.

But the problem is, when I open a form, start a transaction, then before finishing it, I open another form that executes something and does a commit, the commit is general for all the forms opened, and the worst thing is that if one of the forms has an error, because of the lack of values in mandatory fields for example, the error messages appear in other forms and everything seems to be a chaos, without knowing exactly which form originated the error.

Is there a way to avoid the general commit of all the opened forms? I think we could change the way we open them. But we don't want to use CALL_FORM, because we don't want limits to the number of forms opened, the users could need to see information from many different forms opened at the same time. We need it to be one session only, because we have a lot of users, and I think we can't manage such a huge amount of sessions if we assume that each form opened by each user is a different session, and because a lot of information passes from one form to the others during the session.

Thanks in advance,

K
  • 1. Re: Problem with multiple forms opened in one session
    tony.g Journeyer
    Currently Being Moderated
    If you look in the forms online help you will see that open_form has a parameter called session_mode.

    This allows a form to be part of the same thread or in a completely different thread.

    I think that using this parameter will solve your problem. Have a read of the help details.


    rgds
    Tony
  • 2. Re: Problem with multiple forms opened in one session
    kmocampo Newbie
    Currently Being Moderated
    Hello Tony,

    The problem with the session_mode option is that, if i specify that a new database session is created with the new opened form, I increase a lot the number of sessions, and i don't think my dba allows me to do that! I have about 800 users, and each user opens about 8 to 10 forms at the same time. These opened forms pass information between them, so I think that the multiple sessions solution would create more trouble than those in my actual situation...
  • 3. Re: Problem with multiple forms opened in one session
    krzysztof.lorencki Explorer
    Currently Being Moderated
    Is there a way to avoid the general commit of all the opened forms?
    Simplest answer is it depends :). As Tomy said one option will be manipulate with sessions using session_mode parameter. For some reasons you don't want to use such method. Using single database session you're unable to selective commit your changes and Forms has nothing to do here. You can try to play with :SYSTEM.FORM_STATUS variable and one of the following triggers: WHEN-WINDOW-ACTIVATED or WHEN-FORM-NAVIGATE to check whatever form has been changed and then you can display some warning message to user, but that's just my thoughts.
    kikolus
  • 4. Re: Problem with multiple forms opened in one session
    kmocampo Newbie
    Currently Being Moderated
    But, could i define independent transactions by form? I mean, that each form could act as an autonomous transaction?
  • 5. Re: Problem with multiple forms opened in one session
    XeM Newbie
    Currently Being Moderated
    there would be better solutions but i think if in the buttons or procedure in which you calls new forms apply check on form status if it has been changed then call an alert with options either user want to save changes or without saving, accordingly commit the changes or roll back the changes and then call new form.
  • 6. Re: Problem with multiple forms opened in one session
    Askdineshsingh Explorer
    Currently Being Moderated
    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 Runform 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. it have following
    rollback_mode-TO_SAVEPOINT,NO_ROLLBACK,FULL_ROLLBACK
    .
    .
    .

    buddy dont forget to mark it.
    .
    .

    if this helpful then mark it correct/helpful
  • 7. Re: Problem with multiple forms opened in one session
    Askdineshsingh Explorer
    Currently Being Moderated
    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 Runform 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. it have following
    rollback_mode-TO_SAVEPOINT,NO_ROLLBACK,FULL_ROLLBACK
    .
    .
    .

    buddy dont forget to mark it.
    .
    .

    if this helpful then mark it correct/helpful
  • 8. Re: Problem with multiple forms opened in one session
    kmocampo Newbie
    Currently Being Moderated
    So you mean that I have to manage forms to commit changes every time the user tries to open a new one? It means that we definitely cannot work the way we do when we execute procedures with the PRAGMA AUTONOMOUS TRANSACTION condition? Or defining something like savepoints each time I open a form, and then do something to commit only to a certain savepoint, leaving the remaining transactions pending?

    I understand that it's possible to play with the events, and control commits with the form_status and the navigational triggers. We can do that, but, still, I can't understand that we don't have possibility to define savepoints or independent transactions in one session during execution...
  • 9. Re: Problem with multiple forms opened in one session
    Andreas Weiden Guru
    Currently Being Moderated
    I can't understand that we don't have possibility to define savepoints or independent transactions in one session during execution
    How should that work?

    1. Do some action in form a, which issues and INSERT without a commit
    2. Switch to form b, do some action which issues a DELETE without a commit
    3. Switch to form c, enter something in a block and issue a commit.

    How would you resolve this with savepoints?

    If you have to deal with that many transactions, you have to make your dba enable that many sessions in the database.
  • 10. Re: Problem with multiple forms opened in one session
    kmocampo Newbie
    Currently Being Moderated
    How should that work? With savepoints or not, I think about something like this:

    3.- when switch to form C, entering something and issue a commit, the commit will just save the data entered in form c.
    2.- Then, when closing C, and going back to B, if the user issues a commit, the delete is the only transaction saved in the database
    1.- Finally, if the user comes to form A, and exits without a commit, then the only change that is not saved is the insert made in that form

    If some of this events occur following a different order, for example, if the user goes first to form A, leaving form B expecting, and then issues a commit, maybe I would ask about commiting the changes in both forms, given the fact that the user has come back to the first form opened and changed... But this last idea is thinking about something like savepoints. Otherwise, I think each form should commit only its changes...
  • 11. Re: Problem with multiple forms opened in one session
    Andreas Weiden Guru
    Currently Being Moderated
    That not how database transactions work. When you issue an insert into the database and do a delete afterwards, you cannot just commit the delete.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points