LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  How to search for condition A only when it follows condition B

    Employee
    Posted 11-25-2014 07:47

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: johnvvu

    Suppose I've sorted the following time ascending, how would I use brainscript or a node to filter on State == "TX" only when it occurs after a row with the State CA? I only want to see the rows containing TX when a row containing CA preceded it.

    Time State
    Row 1 14:00 CA
    Row 2 14:02 TX
    Row 3 14:04 MO


  • 2.  RE: How to search for condition A only when it follows condition B

    Employee
    Posted 11-25-2014 08:54

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    if firstExec then prev_State = "" #setup initial condition

    emit * where State=="TX" and prev_State=="CA" #emit desired row

    prev_State = State #save value for comparison on next record
    #for this to work correctly, assigning a value to prev_State MUST be done AFTER the emit.


  • 3.  RE: How to search for condition A only when it follows condition B

    Employee
    Posted 11-25-2014 13:48

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: johnvvu

    Thank you, that worked nicely.