In some apps, it is important to track when and where some data was changed. For example, in a field service app, it may be important to record when a certain field was changed.
AppSheet has a simple mechanism to track changes-- via 'Change' column types. There are three "Change" column types-- ChangeTimestamp, ChangeCounter, and ChangeLocation. These column types all have a set of shared characteristics that are specified via the column's Type Qualifier:
- What triggers a change: any change to any other column, any change to some specific fields or a single field, or changes to a specific field that result in one of a known set of values
- What should happen when such a change is detected: increment a counter (ChangeCounter), set a timestamp to the current time (ChangeTimestamp), or record the current location (ChangeLocation)
As a simple example, in the Interview Feedback sample, the Feedback table has a Changes column of type ChangeColumn. The type qualifier doesn't "qualify" the type in any way, so this column will track changes to any other field in the row. If any other row changes, the value of the Changes column is incremented.
A more typical example would want to track changes to specific columns, perhaps even more specifically changes of those columns to specific values. In the Store Inventory sample, the Inventory List table has a Date Checked column. It listens for changes to a specific other column, Quantity In Stock. And in fact, it looks to see if that value changes to 0. If it does, then the column records the current timestamp.
ChangeCounter Update Mode
The ChangeCounter "UpdateMode" controls how the counter increments when data changes occur.
- Accumulate (default): In this mode, the counter increments by 1 per row update when at least one qualifying change occurs. In other words, it counts how many times a row has changed in a way that triggered the counter. An individual row update might occur through a single save of a form, a single QuickEdit in a slideshow view, or a single Action.
- Reset: In this mode, the counter resets to its initial value at the beginning of each update and counts the total number of changed columns that triggered the counter within that update. This mode makes it easy to detect that a particular change occurred during a given update, which is useful for setting up workflow rules that only fire when a specific change occurs.