When applying an analytic, you can specify temporary variables using the AS clause. Set the analytic result as a variable, and then define a condition for that result.
For example, the following rule takes the average of three stock events and compares that average to a three‑day average using a separate DailyStockInfo topic with a property of threedayaverage:
WHEN 3 stock s, dailystockinfo d group by s.symbol WITH average(s.price) AS AvgPrice > 0 AND AvgPrice > d.threedayaverage then response
The group by filter forces the rule to evaluate only matching symbols.
If you set the analytic result as a temporary variable, you can reference that result in the responses. Using the previous example, you would include the AvgPrice temporary variable in the response DRQL to display its value in the response.
The assignment of a particular result to a temporary variable is valid only during the evaluation of that rule. After the evaluation, the value of that temporary variable is removed.