Skip to main content

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.

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.