The Snapshot feature allows you to create internal tables in Ternair from which output details of a selection are recorded. The snapshot can then be used as an input to other selection or output blocks.
Drag a snapshot block into the workspace and connect it to an input block.
You can use the snapshot block only if the selection has been saved.
Double-click on the snapshot block to open the settings.
On the left side is a preview of the internal table.
On the right side you will find the settings.
This section focuses on the following options; each option consists of a tab in the settings (right side) of the snapshot block.
Icon
Option
Description
Mapping
Mapping of personalized snapshot fields
Modifications to data
Possibility to edit fields
Settings
Choose a retention period
Filling in the Mapping and Settings tabs is mandatory, Changes in data is optional.
Preview
The preview (on the left side of the screen) is always visible.
In the top left corner, you can customize the preview data with the following options:
Refresh data.
Please note that if an existing snapshot block is reopened, the already saved data will be displayed. Click the button to show the most recent data.
Show 10, 25, 50 or 100 records
Display random data
In the upper right corner you can change the preview mode from an individual record to a table view with X records in the selection.
Creating the mapping for a snapshot consists of three steps:
Add columns
Select desirable fields
Settings
Rename/customize column header
Select keys for the relevant determine fields
Determine aggregations
Edit field
The ability to customize/transform/combinate columns
1. Add columns
As a first step, select the desired field(s) to include in the snapshot.
When you click on the '+' icon, you will now be presented with a menu with three options.
With the 'Mapping' option, you can add one or more fields to the mapping.
In addition to the fields available in the database, it is also possible to add fields with fixed text values. Click on the 'Fixed values +' field to add a text field with a fixed value. Both the header and value of the field must be specified.
The 'Calculated Value' option allows you to create a calculated field based on Scriban. You can use this, for example, when generating the current date.
Select an item to move it to the preview on the left.
Please note that selecting the entity type will select all (underlying) entities at once (up to 25 fields at a time)
After adding an item, it is possible to customize the column header in the snapshot. The name of a column can be changed by clicking on the item.
Key
A key should be assigned to field(s) containing a key value. Clicking on the key field displays a drop-down menu of available keys. The key icon indicates that a key has been assigned.
Example: select the key 'email' for the email address field. Assigning the key 'email' allows you to combine the snapshot with all other resources that also contain the key 'email'.
The key 'Unique key (not divisible)' can be used for an entity that contains a key value that cannot be found anywhere else in Ternair.
Please note that a key must be assigned to at least one field and at least one key must be mandatory.
Aggregations
Depending on the type of (field) data, aggregations are available.
Aggregations can be used in fields that you can calculate with. The calculator icon indicates that you can apply an aggregation.
For numeric and date fields in snapshots, you can select aggregations. No aggregation is applied if it is not selected (default setting).
Numeric fields
For numeric fields, the following types of aggregations are available:
Summation
Average
Highest
Low
Number
Date fields
For date fields, the following types of aggregations are available:
Highest
Lowest
3. Edit Field
In step 3 it is possible to edit the fields.
Convert upper/lowercase letters
Split fields
Merge fields
Merge fields
Screen fields
Replace
Convert to numeric field, where you can perform calculations for selection criteria, such as a minimum order value
Remove special (whitespace) characters
Hashing fields/columns
Lookup
One-to-many
Within a Snapshot block, you can retrieve and snap data. This data is retrieved based on the selected key. It is possible that there are multiple values for one key. By default, you get the first found value. If this is not desirable, you can select the desired value(s) using the one-to-many functionality.
You can see from the icon below whether the one-to-many functionality is available:
You can use this functionality, for example, to collect multiple orders from a customer. After all, a customer may have multiple orders. To see a customer's most recent orders, it is possible to choose descending 'Sort'. With the number under 'Capping' you specify the maximum number of records you want to see back.
The results can be displayed using a separator, JSON or XML. If you choose a separator you have a choice of comma, lock character, semicolon or tab.
Please note:the one-to-many functionality can only be applied to a Snapshot block and can never be used in conjunction with aggregation.
Modifications in data
Fields modified on the 'Mapping' tab are displayed in chronological order on the 'Changes in data' tab. You can undo changes by clicking the trash can icon.
Instellingen
Op het tabblad ‘Instellingen’ kun je een retentie periode instellen.
Retention
The retention period determines how long the snapshot will remain available in Ternair.
The default retention period for snapshot blocks is one day.
General settings
Option
Description
Block template
Every snapshot block can be saved as a template. After a snapshot block is saved as a template, it can be used as a template for other snapshot blocks. A block template can be reused by clicking on 'Open block template' in the lower left corner of the snapshot block and selecting the template from the list.
Description
You can specify a description for a snapshot block. The description field is intended to specify a logical description for the block. This makes the contents of the output block easily recognizable in the selection flowchart.
Applicate
Clicking the 'apply' button saves the preliminary settings for the selection block.
Cancel
Use the 'Cancel' button to undo your changes.
Save
Using the 'Save' button allows you to save your changes without (re)calculating the block.
Execute
As a final step, the snapshot must be executed. Select the snapshot block and right-click and then click "execute. Executing the snapshot will populate the internal table in Ternair with data.
Creating a snapshot stores the values of selected fields, as they are at the time the block is executed, in the database. The snapshot can then be used at a later time as input for other blocks in the selection.