How to iterate over a column that has different categorical groups?Let's say column called Lot has 3 different entries. And that I wanted to add a logic to create a column called "Box Start" that checks which box runs on sequence 1 and copies that information for all entries of that lot in a column called "Box Start" like how it is done below.
How can I design a for loop to perform this operation?
| Lot | Sequence | Box | Box Start |
| A | 1 | a | Starts on a |
| A | 2 | b | Starts on a |
| A | 3 | a | Starts on a |
| A | 4 | b | Starts on a |
| B | 1 | b | Starts on b |
| B | 2 | b | Starts on b |
| B | 3 | a | Starts on b |
| B | 4 | a | Starts on b |
| B | 5 | a | Starts on b |
| C | 1 | a | Starts on a |
| C | 2 | b | Starts on a |
| C | 3 | a | Starts on a |
Data TableScriptingRe: How to iterate over a column that has different categorical groups?Here is one way to solve the problem; I created a formula that whenever a new value of Lot is found, it calculates when the first occurrence of Lot appeared.

If( :Lot != Lag( :Lot ),
currLot = :Lot;
begin = :Box[Min( Current Data Table() << get rows where( :Lot == currLot ) )];
);
begin;
If you want to iterate in open code, the following code can be used
For Each Row(
If( :Lot != Lag( :Lot ),
currLot = :Lot;
begin = :Box[Min( Current Data Table() << get rows where( :Lot == currLot ) )];
);
Show( begin );
);