Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: event:attr required for where expression

...

Code Block
themeConfluence
langjavascript
select when bank withdrawal where event:attr("amount") > 100

Example 2: Too Many Withdrawals

...

Code Block
themeConfluence
langjavascript
select when count 4 (bank withdrawal where event:attr("amount") > 100) within 24 hours

Example 5: Withdrawal after a Deposit

...

Code Block
themeConfluence
langjavascript
select when bank deposit amount re#(\d+)# setting(dep_amt)
     before bank withdrawal where event:attr("amount") > dep_amt

Example 6: Withdrawal after a Deposit with a Limit

...

Code Block
themeConfluence
langjavascript
select when bank deposit amount re#(\d+)# setting(dep_amt)
     before bank withdrawal where event:attr("amount") > dep_amt || event:attr("amount") > 100

Note that one may combine pattern matching with the where event expression, in order to bind an event attribute to a name for convenience. The previous eventex is equivalent to this:

Code Block
select when bank deposit amount re#(\d+)# setting(dep_amt)
     before bank withdrawal amount re#(\d+)# setting(withd_amt)
     where withd_amt > dep_amt || withd_amt > 100


Example 7: Phone Call with a Follow-Up SMS

...

Code Block
themeConfluence
langjavascript
select when phone inbound_call from re#(.*)# setting (num) 
        and phone sms_received where event:attr("from").match("/#{num}/".as("regexRegExp")) 
   within 1 hour

Example 8: Too Many Phone Calls

...

Code Block
themeConfluence
langjavascript
select when phone inbound_call from app:support_number 
        and web pageview where event:attr("url").match(app:support_website)
  within 1 day

...

Code Block
themeConfluence
langjavascript
select when rss item content re#Stock Symbol: (\w+)# setting (symbol)
     before stock price_change where event:attr("direction") == "up" && event:attr("ticker") == symbol && event:attr("percent") > 2
  within 10 minutes