Computed fields
This feature is in Alpha.
Definition
A computed field is a dynamic field defined in the schema, linked to a script that is triggered for each new user activity or profile update and performs a daily computation of a function's result. It is used when the desired outcome cannot be achieved with existing directives or to simplify an OTQL query by replacing multiple directives with a single field.
Examples:
Get all users with at least a specific amount for one category
Retrieve the most recent event (e.g. last visit, last transaction, etc.)
Identify the top X% of a specific user group (e.g. the top 10% of buyers).
Get the total amount for a specific type of event (e.g. sum of transactions in the last 30 days, total expenditure on a particular category of product, etc.).
Weighted sum (Affinity total, etc.)
Compare multiple channels (e.g. to find the best channel for transactions).
Usage Example
Once live, a computed field behaves like a regular field, making it transparent to the user. Here's how you can use it in practice:
Use Case: Identify Users Who Have Spent More Than 100€ on IT Products in the Last 3 Months
With Standard Directives:
This query uses standard directives to sum the basket amounts for IT products over the last 3 months.
With a Computed Field:
In this version, the computed field IT_amount_3months
is used directly in the query. The field is calculated daily, meaning no computation is performed during query execution. This results in faster query response times, as the value is precomputed and readily available.
Last updated
Was this helpful?