This discussion is archived
4 Replies Latest reply: Jun 30, 2013 12:08 AM by XeM RSS

How to re-load cleared records in a tabular form

XeM Newbie
Currently Being Moderated

Hi All,

 

I am using forms 10g and want to re-load  cleared records on tabular block. The scenario is i have two blocks master and detail, records representation on both blocks are tabular. Update and insertion on detail block also changing master record. Now let say for a master record there are 10 detail records and user cleared five records from them up to here everything is OK master record has the correct value. But real problem starts from here, Now if user navigates to another master record for the previous changes forms default prompt for asking commit changes appears Now if user select YES means commit the changes then all values remains correct. But if user selects No then the records which were cleared comes back into detail block and goes in background as the control goes to another master record and on the detail new records appears for navigated master record. I want to issue alert with two options yes or no when user leaving detail block and if user select yes then no problem i will issue commit for YES but if user press No on alert then what i should do because i want to load all cleared records back in block and re-perform processing to set the value of master record and then leave detail block. I have already played with POST-and New instance triggers on block and records but no use. Now i am looking into clear all master procedure if i could utilize this.


Your replies are appreciated.

  • 1. Re: How to re-load cleared records in a tabular form
    CraigB Guru
    Currently Being Moderated

    I'm confused by your question. 

    XeM wrote:

     

    But real problem starts from here, Now if user navigates to another master record for the previous changes forms default prompt for asking commit changes appears Now if user select YES means commit the changes then all values remains correct. But if user selects No then the records which were cleared comes back into detail block and goes in background as the control goes to another master record and on the detail new records appears for navigated master record. I want to issue alert with two options yes or no when user leaving detail block and if user select yes then no problem i will issue commit for YES but if user press No on alert then what i should do because i want to load all cleared records back in block and re-perform processing to set the value of master record and then leave detail block.

    This is already the default action when you change records.  Forms will ask: Do you want to save changes? (Yes/No/Cancel).  Yes will save and move to the next record.  No will rollback any changes and move to the next record, and Cancel will stop the navigation to the next record and leave any uncommited changes there.

     

    Is there anything else that you need to have happen that is not covered by default functionality?

     

    Craig...

  • 2. Re: How to re-load cleared records in a tabular form
    XeM Newbie
    Currently Being Moderated

    Hi Craig,

     

    Thanks for your response. Yes I want to re-calculate some fields on master block. I have some fields on master block which is calculated from detail block and these calculation are performed in when-validate-trigger on particular fields on detail block and same calculation is also performed in KEY-DELREC trigger on detail block. Everything is working perfectly when user updating values, inserting new record or deleting or clearing a record from detail blocks calculated values on master block remains correct. But when if some records from detail block are deleted and the value on master block is re-calculated and in the meanwhile user navigates to another record on master block in this situation form  is asking to commit un-saved data and user may commit or may not. So if user commit the changes then no problem same with if cancel  but if user select no and not committing changes then the changes are roll-backed and navigation goes to new record on master block where user wished to go. Now How I can re-calculate the values on master block after rollback take place, once all the calculation on master block based on the values in detail block after rollback performed then allow user to navigate to record he wish to.

     

    Thanks

    Xem

  • 3. Re: How to re-load cleared records in a tabular form
    Andreas Weiden Guru
    Currently Being Moderated

    You could do your own logic for Saving, rollback or cancel in the ON-CLEAR-DETAILS-trigger.

  • 4. Re: How to re-load cleared records in a tabular form
    XeM Newbie
    Currently Being Moderated

    Thanks Andreas!

     

    I solved my problem by using the same trigger. I added few more lines of code to CLEAR_ALL_MASTER_DETAIL procedure.

Legend

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