4. Data access and transformation
DataQL reads data through paths and shapes results with =>. External parameters, current transformation items and local variables have distinct access forms.
- Fields and indexes: object fields, list indexes, missing values and bounds.
- Parameters and context: parameter scopes such as
${name}, and$,@,#in transformations. - Result transformation: select, rename, calculate and nest fields.
var order = {"id": 10, "customer": {"name": "Alice"}, "items": [{"price": 20, "count": 3}]};
return order => {
"id",
"customerName": customer.name,
"lines": items => [{"amount": price * count}]
};
{"id":10,"customerName":"Alice","lines":[{"amount":60}]}
Object templates select fields; list templates transform items. Use collection functions for filtering, sorting and grouping.