Derived Field or Calculating Field calculates and stores the values in real time which do no exist in data server or original file by the values of existing fields or application, and enables to use them as common field in grid view, etc.
Since it is calculated value, the user naturally cannot update the value.
You can specify the value which will be calculated by expression or callback property. And, you should specify dataType like common field. If do not specify dataType, it will be set as NUMBER type differently from common field which is set as TEXT by default.
Calculating fields are initialized together with common field by calling DataSet.setFields, and derived fields should be added after common fields in Data Set. And, you can limit at calculating point by sourceFields.
var fields = [
...
];
var calcedFields = [
{
fieldName: "amount",
dataType: "number",
expression: "unit_price * quantity"
},
...
];
ds.setFields(fields, calcedFields);