Updating WebServer fields during record change or insert

I have a field in each table in my NetTalk Server app called “UpBy”. It’s a string field of 200 characters. I want to be able to put some text in it that indicates who inserted or updated it, assuming they made a change and didn’t just view it. Something like

DonnEdwards 2021-04-17 23h08 Add 155.93.152.18

Firstly, where do I initialise a session variable “UserName” to read “Not Logged In”? Once the user logs in I will change it to the actual user name.

Secondly, where do I put the code to generate the string, assuming I want this string to be the session variable “UserName” followed by the date and time, followed by the word “Add” or “Change”, followed by the user’s IP address?

Thirdly, how do I detect whether the record is being inserted or updated? Also, how do I avoid changing the field if the record hasn’t been modified?

All suggestions, ideas and tips will be most welcome. I’m still busy with RTFM, so please forgive me if this is discussed in the documentation. Just point me to an example or section of the notes.

see https://www.nettalkcentral.com/forum/index.php?topic=8813.0

1 Like

In my old Clarion I used to do it as follows.

  1. As soon as the window for the update is opened, I would save the entire record.

  2. While exiting I will check if the saved record is the same as the present record. In that case, nothing will be updated.

  3. If it is not the same, I will check what is the GlobalRequest, it can be ‘Change Record’ or ‘Insert Record’ (These words may be slightly different, but the meaning will be the same. That will tell me if it is a new record or an edit record. I am open for discussion. Please do not accept it blingly and pardon me for the errors if any. I am writing some thing on this aftee a gap of 20+ years.

1 Like