Compute Data
The Compute Data action evaluates a specified expression on each element of an input data array that meets the given filter criteria.
Parameters
| Name | Type | Description |
|---|---|---|
| Data | Array<Object> | The source collection of items to be processed. Each item must expose the properties referenced in the expressions. |
| Filter | String | A Boolean expression that selects which items in Data are included in the computation. Only items for which this evaluates to true are passed to the Expression. |
| Expression | String | The computation to perform on the filtered items. Must include exactly one aggregate function (Sum, Avg, Min, Max, Count, StDev, Var) applied to a single numeric property. |
| Calculated Columns (Optional) | Array<{ Name: String; Definition: String }> | One or more auxiliary expressions that define new, temporary properties on each data item. These may then be referenced inside Expression or Filter. |
See Compute expression syntax for syntax information.
Returns
The output of the Expression applied to the filtered data items. The exact data type depends on the expression used.
| Category | Aggregate Functions | Return Type | Behavior |
|---|---|---|---|
| Numeric Aggregates | Sum, Avg, Min, Max, StDev, Var | Number (floating‑point or integer) | Computes over all filtered items; returns null if no items match. |
| Count | Count | Integer | Counts matching items; returns 0 if no items match. |
| Other Expressions | N/A | Inferred (e.g., integer, string, date) | Evaluates once (ignores array context); returns type implied by expression. |
| Error Condition | Behavior |
|---|---|
| Invalid Reference or Syntax | Throws an error when referencing undefined fields or containing invalid syntax. |
| Type Mismatch in Aggregates | May return null or throw an error if a numeric aggregate is applied to a non-numeric field. |
Examples
- Expression:
Sum(Total) - Filter:
EmpID = 5
[ { "EmpID": 3, "Total": 56.2 }, { "EmpID": 5, "Total": 5.5 }, { "EmpID": 5, "Total": 6.5 }]12Troubleshooting
Click to expand common errors and fixes
Data Is Empty or Not an Array
Cause: The Data input is missing, null, or not an Array<Object>.
Fix:
- Ensure data is supplied and is an array.
- Confirm each array element is an object with the properties referenced by the expressions.
Filter Syntax Invalid or Always False
Cause: The filter expression contains invalid syntax or references undefined properties, causing evaluation errors or excluding all items.
Fix:
- Validate expression syntax and property names used in the filter.
- Test the filter with a known sample item to confirm it evaluates true for items you expect to include.
Expression Syntax Invalid or Unsupported
Cause: The expression contains malformed syntax, unsupported functions, or multiple aggregate functions.
Fix:
- Ensure the expression uses exactly one aggregate function when evaluating over the array (e.g., Sum(Total)) or is a valid scalar expression when array context is not required.
- Consult the expression syntax reference for correct function names and argument forms.
Aggregate Applied to Non-Numeric Field (Type Mismatch)
Cause: A numeric aggregate (Sum, Avg, Min, Max, StDev, Var) references a property whose values are non-numeric or inconsistent.
Fix:
- Confirm the target property contains numeric values for all items that pass the filter (or handle coercion explicitly in a calculated column).
- Use a calculated column to convert or sanitise values before aggregation.
Multiple Aggregates or Ambiguous Expressions Used
Cause: The expression includes more than one aggregate or mixes aggregate and scalar semantics incorrectly.
Fix:
- Restrict the primary expression to a single aggregate when operating over filtered items.
- Restructure to compute auxiliary values via calculated columns and then apply a single aggregate.
No Items Match the Filter (Empty Result)
Cause: The filter excludes all items.
Fix:
- Verify the filter criteria; if Count is used expect 0.
- For numeric aggregates, the return will be null if there are no matching items. Handle this case explicitly in downstream logic.
Calculated Column Evaluation Fails
Cause: Calculated columns reference undefined properties or use invalid expressions, causing per-item computation to fail.
Fix:
- Validate each calculated column definition independently.
- Ensure calculated column names are unique and referenced correctly in filter and expression.
Division by Zero or Invalid Numeric Operations
Cause: Calculated columns or expressions perform operations (e.g., division) without guarding for zero or null values.
Fix:
- Add guards or conditional logic in calculated columns to handle zero/null cases (e.g., conditional If or Coalesce-style checks).
Performance Issues with Very Large Datasets
Cause: Processing large arrays with complex calculated columns or filters may be slow or resource intensive.
Fix:
- Simplify filter logic and calculated columns where possible.
- Pre-filter data to the minimal required set before complex calculations.
- Test with representative sample sizes to understand performance characteristics.
Generic Runtime or Evaluation Error
Cause: Unexpected or malformed input, unhandled null/undefined values, or internal evaluation errors.
Fix:
- Inspect sample inputs closely for malformed items or inconsistent schemas.
- Add defensive calculated columns to normalise or default missing values.
- Reproduce the error with a minimal dataset to isolate the failing expression.
Quick Checklist
- Data is a non-empty Array<Object> and each item exposes required properties.
- Filter (if provided) uses valid syntax and evaluates true for expected items.
- Expression is syntactically correct and uses at most one aggregate when operating over filtered items.
- Numeric aggregates reference numeric properties (or use calculated columns to coerce types).
- Calculated columns are validated independently and referenced by correct names.
- Handle empty-match cases (null for numeric aggregates, 0 for Count).
- For large datasets, test performance with representative samples and simplify expressions where possible.