Method 1: Manually maintain log: –
To do this we have to create a log table which will store all the data changes.
We can have fields like table_name, pk_value_of_the_record, field_name, old_value, new_value, modified_by_user_idx,modification_date, etc..
For this Servoy has some table level events like
onRecordInsert
onRecordUpdate
onRecordDelete
To keep track of the updates, create a global method and attach it to the “onRecordUpdate” event of the table. This method automatically takes a parameter “record” of type JSRecord.
In the method we can retrieve all the field values by the following code.
function checkUpdateRecord(record) { var table_name = record.foundset.getDataSource().split('/')[2]; var pk_value_of_the_record = record.getPKs()[0]; //When multi select is not done var modified_by_user_idx = //User index of the currently logged in user
var modification_date = application.getServerTimeStamp();
var dataset = record.getChangedData();//it will return all the changed data of type JSDataSet
//Loop through the modified fields for( var cnt = 1 ; cnt