In this blog post, we’re thrilled to introduce a powerful method to revolutionize how you manage and track changes within your data store. We’ll unveil the concept of a “stamp”, a specialized marker designed to streamline your data modification monitoring and show you how to tailor these stamps to your unique requirements.
What is a Stamp
Before diving into the details, let’s clarify what a “stamp” means in this context. Essentially, a “stamp” serves as a marker to track data entity modification, enabling you to maintain a comprehensive record of changes made to your data.
Data change tracking
ENABLE DATA CHANGE TRACKING
You can initiate data change tracking through a straightforward process. Begin by right-clicking on the table or tables you wish to monitor within the structure window. Select the item menu labeled “Enable data change tracking” from there.
Note: this simple action sets in motion the creation of two indispensable components: a “__GlobalStamp” field and a “__DeletedRecords” table. These elements form the foundation for precise and effective tracking and managing data modifications within your data store.
Getting Data change
The .getGlobalStamp() function is a critical tool that empowers users to retrieve the current global modification stamps associated with their data store. These stamps act as indicators of your data’s modification status, providing invaluable insights into changes and updates within your dataset.
Get data change since yesterday’s example.
//1. First we store the current global stamp for a futur usage
//2. Then the next day, we read the stamp that we stored the day before.
var $yesterdayStamp : Integer
$yesterdayStamp := ReadStoredStamp()
//3. Get the list of modified entities in our 'product' table
//since the stamp stored the previous day.
var $modifiedProd : cs.productSelection
$modifiedProd:=ds.product.query("__GlobalStamp >= :1"; $yesterdayStamp)
In this example, StoreTodayStamp and ReadStoredStamp are project methods you will need to create to store and retrieve a reference stamp.
Get dELETED RECORD INFO SINCE yesterday’s example.
//4. Get info about deleted entities since the stamp stored the previous day.
var $deletedProdInfo : cs.__DeletedRecordsSelection
$deletedProdInfo:=ds.__DeletedRecords.query("__Stamp >= :1"; $yesterdayStamp)
This feature puts you in the driver’s seat in a world where precise data management is crucial. It provides clear insights into your data’s changes, allowing you to monitor it effectively, just like in the HDI. Moreover, it enables accurate data synchronization, perfect for incremental updates. It is also a more modern way to deal with data synchronization than Replication via SQL. This feature is the key to efficient data control, making managing, monitoring, and tracking changes in your data store easier. Welcome to a smarter approach to data management, with benefits ranging from monitoring to backup and incremental synchronization.