Temporary Record and then saving it

andy76andy76 Member Posts: 616
Hello,

I am cycling on a record (Reservation Entry) to find some information with repeat until...I have to split a couple in a lot of couples but I don't want that new couples came taken by my first cycle otherwise it becomes an infinite loop.

So I though to declare a new record variable on Res. Entry with flag Temporary and insert new records there.
At the end of all my processing (Report - on Post Report) I want to save all the records on my Temporary record variable in the real Res. Entry table.

Is that possible? riskious? How do I have them ? Do I have to cycle?
Or is better to create a new table identic to Res.Entry and then transfer from that?

Thank you very much

Andy

Comments

  • krikikriki Member, Moderator Posts: 9,110
    You're doing it the correct (and fastest) way.
    -looping the real table and saving your data in a temptable
    -after the loop : saving the temptable in the real table.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • andy76andy76 Member Posts: 616
    Thank you

    But what is the correct/better way to save the temporary record to real table?
    Transferfields or INSERT with loop or ....?
  • krikikriki Member, Moderator Posts: 9,110
    You have to loop your temptable. There is no other way to read all records from the temptable.

    How to transfer the data. This depends. If for example you need to create records in Sales Lines,Item Journal Line,... you best create your temptable assigning ONLY the necessary fields. Then create the real table and VALIDATEing the values in the real table.
    If you have some table in which there are no triggers, you can just do
    recRealTable := tmpTempTable;
    recRealTable.INSERT(FALSE);
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.