I have 2 columns “LUCE” and “LUCENum” that represent the light cycle (a cycle always start with one ON, then there are random numbers of LIGHT, and always finish with one OFF).
LUCE LUCENum
ON 1
LIGHT 2
LIGHT 2
OFF 3
ON 1
LIGHT 2
LIGHT 2
LIGHT 2
LIGHT 2
OFF 3
ON 1
LIGHT 2
OFF 3
(Where 1 =ON; 2 = LIGHT; 3 = OFF).
Using Loops I would like to create a new column called RESULT with an ID for each cycle. In other words the column Result will contain a count that increase each time LUCENum = 1.
This is the desired result:
LUCE LUCENum RESULT
ON 1 1
LIGHT 2 1
LIGHT 2 1
OFF 3 1
ON 1 2
LIGHT 2 2
LIGHT 2 2
LIGHT 2 2
LIGHT 2 2
OFF 3 2
ON 1 3
LIGHT 2 3
OFF 3 3
Attached you will find an example of what I tried to do, but it doesn’t work.
Huh. I could have used that one a while ago... Didn't know about the Times Series Missing Value back then. I don't like that you have to resort by RowID though. GroupBy has the option to retain row ordering, but I couldn't get my Joiner to do that.
Here's another tip: The Math Node is kind of a cheat, a Java Snippet in disguise. But there's the Counter Generation Node for the rescue.