2 Replies Latest reply: Nov 27, 2012 11:04 PM by Gurujothi RSS

    Save unsaved(Newly entered) records

    Gurujothi
      Hello Everyone,

      I am working on Oracle applications 12.1.2 and Forms [32 Bit] Version 10.1.2.0.2
      I have a custom form in which there is one Header_Block and Detail Block,
      in Header Block I have 2 buttons Save and Process,

      when the record is entered in Detail Block and when pressing the Save button it will be saved and after saving when clicking the button Process, the saved records will be Processed.

      Suppose If I save 2 records and closed the form without Processing those record,
      when opening the form next time those 2 (Unprocessed)records will be displayed(using Execute_query) and now by pressing Process button It will be processed.

      Now what I want is as I mentioned above If I save 2 records and closed the form without Processing those record,
      when opening the form next time those 2 (Unprocessed)records will be displayed,
      without clicking Process button if I insert one more record(3rd record) and If i press the Process button the message has to be displayed that "*Save the unsaved record in the block,then Process*"
      and It should not Process the 2 records which already saved.

      i.e When there are 3 records, in which 2 are saved and 1 is (3rd) unsaved (Newly entered)
      They must have to save the 3rd one then only it should be processed.

      Sorry for the long post.
      Can anyone help me in this?

      Thank you,

      Regards,
      Guru

      Edited by: Gurujothi on 27 Nov, 2012 6:43 PM

      Edited by: Gurujothi on 27 Nov, 2012 6:45 PM
        • 1. Re: Save unsaved(Newly entered) records
          MLBrown
          Put logic in your PROCESS_BUTTON that checks :SYSTEM.FORM_STATUS. If it is 'CHANGED', then display an alert.

          1. Create an Alert:
          - Under the Alerts node create a new one.
          - Assign a name like UNSAVED_CHANGES_ALERT
          - Give it a Title like "Unsaved Changes"
          - Choose an Alert Style - Caution for example
          - Set Button 1 Label to "OK"
          - Leave the other Button labels null so only one button is displayed in the alert.
          - Set the Default Alert Button to "Button 1"
          - Assign any visual attributes, colors, fonts, etc...

          2. In your PROCESS_BUTTON WHEN-BUTTON-PRESSED trigger add something like this:
          declare
            v_alert         alert;
            button_pressed  number(12);
          begin
            if :SYSTEM.FORM_STATUS = 'CHANGED' then
              v_alert := FIND_ALERT('UNSAVED_CHANGES_ALERT');
              button_pressed := show_alert(v_alert);
              raise form_trigger_failure;
            end if;
          end;
          Hope this helps - mike
          • 2. Re: Save unsaved(Newly entered) records
            Gurujothi
            >
            if :SYSTEM.FORM_STATUS = 'CHANGED' then
            Thank you so much before I tried to check the status using :stage_block.status = 'NEW' and GET_RECORD_PROPERTY
            but doesn't help me,as you suggested :SYSTEM.FORM_STATUS is solved my problem.

            Thank you.

            Regards,
            Guru