NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: terryd on July 26, 2013, 01:37:23 AM

Title: Listing changes to an existing record
Post by: terryd on July 26, 2013, 01:37:23 AM
I need to write to a history file if the value of certain fields in a change form have been amended.
Where is the best embed point to get the values of the record being loaded before any amendments take place?
My plan is to write to  session values at that point and then in the postupdate embed point read the table compare changes and then write the changes to the history file, then delete the session variables.
I need to know an embed point which is just after the record is read.
Title: Re: Listing changes to an existing record
Post by: Bruce on July 26, 2013, 04:09:20 AM
>> Where is the best embed point to get the values of the record being loaded before any amendments take place?

PreUpdate  routine
(also PreInsert and PreCopy and PreDelete depending on what you need.)

hint: There's a method called FileToSessionQueue that may come in handy here. This basically pushes all the file fields into session values _with_ the opportunity to set a "prefix" on the fields. So, in other words, in the embed point your code would just be one line;

p_web.FileToSessionQueue(Customers,false,'HIS')

so Cus:Name would be pushed into the Session queue as HISCus:Name

The first parameter is the file name, the second pushes the field into the Value queue as well (not needed for you in this case), and the third is the Prefix. Prefixes can be up to 5 characters long.
(hint - don't use _old_ - that's already used by me.)

um - well actually if you don't embed any code in the updates at all, chances are

p_web.GSV('_old_cus:Name')

returns what you are looking for. (But test that.)

Cheers
Bruce





Cheers
Bruce
Title: Re: Listing changes to an existing record
Post by: terryd on July 28, 2013, 12:33:22 AM
Thaks Bruce
Looks like just what I need.