2 Replies Latest reply: Oct 28, 2016 3:40 AM by Sergii Karandin RSS

    Changing session number depending on time difference

    Sergii Karandin

      Hi everyone, I came across this task:

      change the number of session in case user was inactive for more that 30 minutes.

      Would appreciate any help

       

      So I have the following input data on logs:

      TimeSessionetc...
      10:00:001
      10:05:001
      10:50:001
      11:00:001
      11:55:001

       

      I want to check the difference between two consecutive timestamps and if the difference is greater that 30 min, I assume that user has ended previous session and started a new one, like:

       

      TimeSessionetc...
      10:00:001
      10:05:001
      10:50:001.1
      11:00:001.1
      11:55:001.2

       

      I assume my code would look something like, but it obviously wouldn't work

      Table:

      load Time,

        //Session,

        if(Previous(Time) - Time > 30, Session+0.1, Session) as Session

      Resident Table_tmp;

       

      Would appreciate any help, thank you