This discussion is archived
5 Replies Latest reply: Jan 3, 2013 10:09 PM by HamidHelal RSS

Save record before moving to next row in the data block

faisal niazi-2368916 Newbie
Currently Being Moderated
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 Guru
    Currently Being Moderated
    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 Newbie
    Currently Being Moderated
    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 Guru
    Currently Being Moderated
    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 Journeyer
    Currently Being Moderated
    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 Guru
    Currently Being Moderated
    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...

Legend

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