5 Replies Latest reply: Jan 4, 2013 12:09 AM by HamidHelal RSS

    Save record before moving to next row in the data block

    faisal niazi-2368916
      Hello

      In forms 10g, I have one detail block, in the detail block i want the user to first save the current row and then move to the next row, in the validate_record trigger I have checked the system.block_status =new but its not working and the user is still able to move in the rows below without saving the record in the upper rows.

      any tips?
        • 1. Re: Save record before moving to next row in the data block
          Prabodh
          Hi,
          In forms 10g, I have one detail block, in the detail block i want the user to first save the current row and then move to the next row, in the validate_record trigger I have checked the system.block_status =new but its not working and the user is still able to move in the rows below without saving the record in the upper rows.
          How are you trying to save only 1 record in the detail block? can you describe what you are doing and post your code snippet?

          Forms are transaction oriented and work at the form level. If your detail block is based on table then the records will be saved when you execute COMMIT_FORM built-in.

          As an intermediate saving mechanism you have POST built-in, but again it is not record wise.

          The only way that comes to mind is that you commit the forms and re-query the detail block after every record. But that will be a huge overhead.

          Cheers,
          • 2. Re: Save record before moving to next row in the data block
            faisal niazi-2368916
            Thanks for the reply, well I have one detail block , in which the data entry will be done for almost the whole day , if the user keeps on moving from one record to other then there is chance of loosing the data , plus there are reports built of this data and if the user does not save the record in each row I am afraid the reports will not present the complete data for a particular time of the day.

            ++The only way that comes to mind is that you commit the forms and re-query the detail block after every record. But that will be a huge overhead.++

            How can i do that?
            • 3. Re: Save record before moving to next row in the data block
              Prabodh
              Thanks for the reply, well I have one detail block , in which the data entry will be done for almost the whole day , if the user keeps on moving from one record to other then there is chance of loosing the data , plus there are reports built of this data and if the user does not save the record in each row I am afraid the reports will not present the complete data for a particular time of the day.
              <b>++The only way that comes to mind is that you commit the forms and re-query the detail block after every record. But that will be a huge overhead.++</b>

              How can i do that?>

              If this the requirement then using a multi-row / tabular block is not the right thing. You should allow entry of one detail row and on saving it present an empty block where the user can enter a new record.

              Cheers,
              • 4. Re: Save record before moving to next row in the data block
                MLBrown
                Somehow the user has to move to the next record - a button, down arrow, etc... If you have a button on your form that the user presses to move to the next record just add logic to it that checks to see if the record has been changed and if it has then display an alert and make them save the record before allowing them to move on.

                Something like this (WHEN-BUTTON-PRESSED trigger):
                if :system.form_status = 'CHANGED' then
                  message('You must save your changes before you move to the next record');
                  raise form_trigger_failure;
                end if;
                Of course I wouldn't user the MESSAGE built in to display a message, I would probably create an alert and display it that way.
                • 5. Re: Save record before moving to next row in the data block
                  HamidHelal
                  Ogrey wrote:
                  Hello

                  In forms 10g, I have one detail block, in the detail block i want the user to first save the current row and then move to the next row, in the validate_record trigger I have checked the system.block_status =new but its not working and the user is still able to move in the rows below without saving the record in the upper rows.

                  any tips?
                  Yes. you can do auto commit when changing the row.

                  At When-New-Record-Instance trigger write
                  commit_form;
                  hope this helps...