Update indicator

I have a need to implement some form of indicator showing if the record has changed. For example if there is a date or time stored or any kind of string, when the data in that record is changed I want to display it in red or show some icon etc. Currently I use one field which registers the moment the data is updated (they type is TIMESTAMP). I’m thinking about creating another field of the same type (ie. called last update) and comparing the two fields on OnRecord event. If the comparison would bring FALSE value the two TIMESTAMP values are different. This however does not prevent the fact that the rest of the data might be unchanged.

For example if I open a record (using the form) then click on SAVE (without changing any data), the TIMESTAMP() value will get updated (I think) but the data hasn’t changed, so this record should not show up as changed…

What would be in your opinion the most efficient solution for something like that ?

ARTHUR

You can use sc_changed(*) macro onValidate to detect if field changed, and your new field is not needed, instead “autoupdate” your change field, update just if some field changed.

(*) http://www.scriptcase.net/docs/en_us/scriptcase-macros/scriptcase-macros#sc_changed

Giu - thanks for replying. I think this macro can be used only on Form. It is useful when (while the form is open) we can verify if another field on the form was OR wasn’t changed and based on the result we can do some other action (i.e hide something, update something etc…). what I need is

an indicator on the GRID that will simply show if the record has changes since the last time the user has opened the grid, so let’s say to place additional column which would show word UPDATED in red. I do not think this macro would do it (the help is listing it only for grouping results on the frid and most functionality is assigned to form - which I’m not interested in).

ARTHUR

Yes, What I mentioned was to avoid to update the “updated” field if there aren’t any updates, but yes, you have to iterate over all the fields.

On grid, you can save onRefresh the date on a global var, and onRecord compare this date with your “update” field,. and mark the field as red, a text on a new virutal field or whatever you want.
Grid will be no updated if you don’t refresh it (or activate the autorefresh option)

That would almost work, but if the user closes the App then reopens it the Variable data (DATE() from the last update will be lost. IT seems lie both dates have to be stored in database. I wonder if I could use LastUpdate (ie. TIMESTAMP) field and compare it with the current date/time. In this case the only problem would be to make sure the user curent time and the sever current time are the same.

ARTHUR