In this chapter, we will add columns that show times and user names of the latest updates.
This helps team members to understand who and when changed data.
You may use the following solution in a friendly environment. Otherwise, you have to use database triggers.
Let's select the companies worksheet, the Companies table, and launch Publish Wizard.
Follow the steps. At the design tab, add the following columns:
You may change column names and data types in your solutions.
Specify the same table name at the following step and execute the SQL script to recreate the table.
Do not click Finish to skip the creating a new table in the workbook. Click Cancel at this step.
Let's reload data and configuration on the existing worksheet. You will see new fields in the Companies table:
Let's add the following handlers for the Companies table in the EventHandlers table:
The FormulaValue handlers update cell values on row changes using the specified formulas.
=NOW() is an Excel formula. You may use this technique for other formulas too.
=UserName() is a SaveToDB add-in formula. You may use =DomainUserName() also.
The DoNotChange handlers prevent changes in the LastModified and UserName columns.
Let's switch to the companies worksheet and change a couple of cells.
As you may see, the add-in updates the values in the LastModified and UserName columns.
This technique is very simple. You may add this feature to your tables quickly.
However, note that such columns may be updated with any values directly in a database using SQL.