When working with files, Stambia offers the possibility to create and use Computed Fields.
These particular fields, on which an expression is configured, are calculated at execution when the file is read.
It can be useful to simulate a Primary/Foreign Key for example in hierarchical files.
Note that Computed Fields should be used only for reading. They are "virtual" fields, they do not exist on the file, and the calculated values can vary at each execution.
Creating Computed Fields
To create Computed Fields, Right click on a file or record and choose New > Computed Field
Then fill the parameters corresponding to your needs.
1 - Computed Fields have a different icon, to differentiate it from the normal fields.
2 - The Expression is the function which will be used to calculate the field.
The available functions are:
id() | Generates an ID |
localPosition() | Indicate the record/row number |
timestamp() | Generates a timestamp |
uuid() | Generates an UUID |
Using ancestor parameter
It is possible to make "links" between Computed Fields, like a Primary/Foreign key would do in a table.
For that, the Ancestor Level Base
parameter has to be set.
Example:
The two fields have the expression set to localPosition()
and the cusPosNumber in the sub-record has the Ancestor Level Base
parameter set to 1.
With this settings, each Phone of the same customer will have the same cusPosNumber, like a table Foreign Key would do.
Note:
- If the ancestor is not set, a new value will be attributed to the field.
- For Primary Key/Foreign Key simulation, you must use localPosition(). Especially if you have multiple sub-records, because the other expressions are generated on the fly and can vary for each of it.