How can I add failure column with a column name from where test data start missing?
Here is the formula I cam up with
As Constant( firstCol = 3; nTests = 5; lastCol = (firstCol + nTests) - 1; dt = Current Data Table(); ); nPass = Length( Loc( dt[Row(), Index( firstCol, lastCol )] ) ); If( nPass == 5, x = "Pass", x = Column( (firstCol + nPass) - 1 ) << get name ); x;
Other option
Names Default To Here(1); dt = Data Table("Untitled"); dt << New Column("Col", Character, Nominal); test_cols = Filter Each({colname}, dt << Get Column Names("Continuous", "String"), Starts With(colname, "Test ")); For Each Row(dt, idx = Max(Loc(dt[Row(), test_cols])); If(idx >= N Items(test_cols), :Col = "Pass" , :Col = test_cols[idx]; ); );