Table of Contents

Search

  1. Preface
  2. RulePoint
  3. RulePoint Concepts
  4. Using RulePoint
  5. RulePoint Objects
  6. Working with Topics
  7. Working with Connections
  8. Working with Sources
  9. Working with Responders
  10. Working with Responses
  11. Working with Watchlists
  12. Working with Analytics
  13. DRQL
  14. Working with Rules
  15. Working with Alerts
  16. Setting Access Controls
  17. Troubleshooting RulePoint Issues
  18. Connecting to an Ultra Messaging Application
  19. Creating an Ultra Messaging JMS Source

User Guide

User Guide

Analytics with Temporary Variables

Analytics with Temporary Variables

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.

0 COMMENTS

We’d like to hear from you!