Sc_changed Macro

Hi, I would like to explain to you a need I have in a project that I am doing.
I have a table with several fields. I should create a historical table of all the variations on the various records.
Basically, at each change of the record the previous data must be inserted in a historical table.
The problem is that I could not find a macro that with a single instruction tells me if the record has been changed.
At the moment I solved it with the sc_changed macro which in the onBeforeUpdate event returns me if I have changed a field. I run the macro on all the individual fields, which in this case are many.
There is a macro that returns me if the record has been changed.
I thank you in advance.
Massimo

Hi Massimo
Why don’t you use the database for this type of operation?
A trigger and a few lines of code solves it fine. I did it for Sql Server but I think it can be done with any other.

Create an update trigger on the table that set the flag changed on record that has been changed. If you want to keep track of the changes you can use the same trigger to insert in another table the original record prior changes. Look into the documentation of your db about update trigger.

Thank you for the quick answers.
I use oracle as a database.
In my procedure, before updating I store the previous values ​​and in case of variations they populate a historical table. To check if the values ​​change, I use the sc_changes macro.
Everything works, but I thought there was an instruction that returned me a flag, record modified yes / no.
When I was programming in an oracle environment with plsql there was an instruction that checked if the record had changed, I avoided testing every field.
It was faster perhaps because I was using a proprietary oracle language.
I’ll see if at the database level it is possible to simplify the procedure.
Thank you

Massimo

I know this is an old thread but I think the original poster @mcampea had a good point.

If I add a button to my form which takes me to a different form, I would like to check first if the record is “dirty” - ie has the user changed anything. If they have, I don’t want to move to the other screen and lose their changes.

At the moment I have to used the sc_changed() macro on EVERY SINGLE FIELD in turn to decide if the record is dirty. If there were an sc_changed_record() macro, it would be a single line of code to check.