SMART datagrid v.1 > Classes > DerivedField
Expression which returns the value to be saved in field.
You can directly use the name of common fields as variable in expression, but should not refer other derived field. You can also return the value by callback property instead of this expression.
You can use the variables listed in the table below in expression besides common field names.
Defaults to null.
Variable | Explanation |
---|---|
'row' | The index of data row |
'values' | Get the value by field name or field index of common fields. |
var fields = [];
var calcedFields = [
{
fieldName: "amount",
dataType: "number",
expression: "unit_price * quantity"
},
...
];
ds.setFields(fields, calcedFields);
When the field name starts with number, since expression parser will read it as number value, you should use "values" variable.
var fields = [];
var calcedFields = [
{
expression: "values['01_unit'] * values['02_unit']"
},
...
];
You should not refer other derived field in expression.