/
Variable Correlation Between Eventexes

Variable Correlation Between Eventexes

You've seen that the setting clause can be used to capture values in regular expressions and bind them to variables in primitive events. When a value is bound to a variable, it can be used in subsequent subexpressions in the same eventex. (To be less ambiguous, variables bound in one eventex can be used in enclosing eventexes. Parentheses can be used to ensure that the nesting of event subexpressions is what the developer desires.) For example, suppose you want to see if someone has viewed the same page twice without having to specify the page. You don't care which page they view, as long as they view it twice.

select when web pageview url re#/archives/(.*)# setting (a)
     before web pageview where event:attr("url").match(("#/archives/"+a+"#").as("RegExp"))

This eventex takes advantage of the expression language's type coercion operator, as, to construct a string using the value from the first eventex and then turn it into a regex for the second match.

Related content

Capturing Values
Capturing Values
More like this
Attribute Matching
Attribute Matching
More like this
Attribute Expressions
Attribute Expressions
More like this
Event Operators
Event Operators
More like this
Event Attributes
Event Attributes
More like this
Finding Individual Events
Finding Individual Events
More like this

Copyright Picolabs | Licensed under Creative Commons.