@sumanthcb141977
try the following. it is not robust and requires the data to be sorted by SN and then date.
New Table( "Untitled",
Add Rows( 36 ),
New Column( "SN",
Character,
"Nominal",
Set Values(
{"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B",
"B", "B", "B", "B", "B", "B", "B", "B"}
)
),
New Column( "Comment",
Character,
"Nominal",
Set Values(
{"Cycle", "Cycle", "Cycle", "Cycle", "Cycle", "Cycle", "Cycle", "Cycle",
"End of Cycle", "Cycle", "Cycle", "Cycle", "Cycle", "Cycle", "Cycle",
"End of Cycle", "Cycle", "Cycle", "Cycle", "Cycle", "Cycle", "Cycle",
"Cycle", "Cycle", "Cycle", "Cycle", "End of Cycle", "Cycle", "Cycle",
"Cycle", "Cycle", "Cycle", "Cycle", "Cycle", "Cycle", "Cycle"}
)
),
New Column( "iteration count",
Numeric,
"Nominal",
Format( "Best", 9 ),
Formula(
If(
Row() == 1, 1,
Lag( :SN ) == :SN & Lag( :Comment ) == "Cycle",
Lag( :iteration count ),
Lag( :SN ) == :SN & Lag( :Comment ) == "End of Cycle",
Lag( :iteration count ) + 1,
Lag( :SN ) != :SN & Lag( :Comment ) == "End of Cycle", 1
)
),
Set Selected
)
)
perhaps others have a more robust way of indexing this.