Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Ironzem
Contributor III
Contributor III

Flag setup

Hi , I need help in setting a flag - In the following data I have 3 rows , The flag needs to be set per Token based on the Status.

1. All 1st Entry flagged - that I got right by using  If(match(Status,'1st Entry'),1) as FlagEntry,

2. Flag Exit status based on previous status - If Exit comes after a 1st Entry or Transfer = Flag 0 if Exit comes after an Exit or no value =Flag 1

Token Status TImestamp Desired Flag output
444733439845528493 1st Entry 18-09-2022 08:02 1
444733439845528493 Exit 18-09-2022 08:08 0
444733439845528493 Transfer 18-09-2022 08:09  
444733439845528493 Exit 18-09-2022 08:10 0
444733439845528493 Exit 18-09-2022 08:19 1
444733439845528493 Exit 18-09-2022 08:34  
444733439845528493 1st Entry 17-09-2022 04:42 1
444733439845528493 Exit 17-09-2022 04:55 0
444733439845528493 1st Entry 17-09-2022 09:18 1
444733439845528493 Exit 17-09-2022 09:42 0
444733439845528493 Exit 17-09-2022 09:43 1
17839739266241238273 1st Entry 18-09-2022 04:08 1
17839739266241238273 1st Entry 18-09-2022 04:23 1
17839739266241238273 Exit 18-09-2022 04:25 0
17839739266241238273 Exit 18-09-2022 04:29 1
17839739266241238273 Transfer 18-09-2022 06:22  
17839739266241238273 Exit 18-09-2022 06:27 0
17839739266241238273 Exit 18-09-2022 06:46 1
17839739266241238273 1st Entry 18-09-2022 08:14 1
17839739266241238273 Exit 18-09-2022 08:14 0
17839739266241238273 Transfer 18-09-2022 08:15  
17839739266241238273 Exit 18-09-2022 08:21 0
17839739266241238273 Exit 18-09-2022 08:52 1
17839739266241238273 Transfer 18-09-2022 08:52  
17839739266241238273 Transfer 18-09-2022 08:58  
17839739266241238273 Exit 18-09-2022 08:59 0
17839739266241238273 Transfer 18-09-2022 09:00  
17839739266241238273 Exit 18-09-2022 09:06 0
17839739266241238273 Exit 18-09-2022 09:14 1
Labels (2)
1 Solution

Accepted Solutions
lockematthewp
Creator II
Creator II

If(Status = '1st Entry', 1, if(peek(Status) = 'Exit'), 1, 0))

View solution in original post

2 Replies
lockematthewp
Creator II
Creator II

If(Status = '1st Entry', 1, if(peek(Status) = 'Exit'), 1, 0))

Ironzem
Contributor III
Contributor III
Author

Thank you