NetTalk Central

Author Topic: Listing changes to an existing record  (Read 2476 times)

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Listing changes to an existing record
« 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.
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Listing changes to an existing record
« Reply #1 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

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Listing changes to an existing record
« Reply #2 on: July 28, 2013, 12:33:22 AM »
Thaks Bruce
Looks like just what I need.
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186