Custom Fields
You can define custom fields using the expression attribute in a table column or element definition.
There are several special functions you can use in expressions. Some tools add more functions specific to that tool (for example, the network viewer has a number of helpful functions relating to the selected device/condition). For example, you can use the $subst() function to substitute using fields in the corresponding formatNls.ts file. By default, this uses the base column (without the “#”), but can accept a different column name as an optional second parameter.
For example:
Note: This example is in JavaScript notation like you would see in the product reference configuration, not JSON format like you would apply in the configuration overrides.
TABLE: <GridDefinition>{
...
columns: [
// create a column called #METER_PHASES that substitutes
// the value of the METER_PHASES attribute based on the
// "phases" entry in formatNls.ts
{
field: '#METER_PHASES',
expression: '$subst("phases")'
},
// Create a column called #VOLTAGE_STR which
// concatenates the 3 VOLTAGE_X attributes separated by /
{
field: '#VOLTAGE_STR',
expression: 'VOLTAGE_A + "/" + VOLTAGE_B + "/" + VOLTAGE_C'
},
...
// Define a text field that sums 3 critical counts together
CRIT_DHN_GROUP: {
expression: 'data.event.critDCustOut + data.event.critHCustOut + data.event.critNCustOut',
type: ElementType.Text
},
 
And in the formatNls.ts file:
...
phases: {
1: 'A',
2: 'B',
3: 'AB',
4: 'C',
5: 'AC',
6: 'BC',
7: 'ABC'
},