ForEach row If condition - condition not being recognized when true

Hi all,

I’m having a problem with an If statement condition within a For Each row activity, where the condition in the If statement is not being recognized when true, causing all rows to go into the ‘Else’ instead of the ‘Then’. I’ll explain below in further detail.

My automation is within a 1SAP transaction, with the part not working correctly being where I extract a structured data table of payments from a SAP screen. This data table is then filtered to remove invalid valid payments leaving only those that are valid, “dt_ValidPayments”. The For Each row loop is then supposed to iterate through each payment row and perform a validation check on specific columns to ensure they are in the required values/format, with any rows not meeting the condition requirements being added to a new data table, “out_dt_PaymentAnomalies”.

When I perform this part of the automation though the rows that satisfy the condition are not recognized as such and so the entire dt_ValidPayments data table is added to the out_dt_PaymentAnomalies data table. When looking in debug i can see that the data table has been extracted correctly and the row is recognized, but when looking at for example “row(3).ToString” in Immediate, that also appears with a compiler error.

Refer below for screenshots of the condition and the context of the activity. Any help with why this is occurring would be greatly appreciated.


Can you write each condition separately and check which is failing in the immediate panel.

And also I hope you used column index based on 0 right? that means first column index will be 0 not 1



For now,can you set Breakpoint at not Body but If activity then check each value. I suppose row is not effective before Body.


Hi @Anil_G @Yoichi ,

I’ve rechecked the column indexes and there was an error there which i corrected and reran but the same errors appeared.

I’ve set the breakpoint at the If activity and checked values again and that has shown slightly better results, with row(9) being recognized with no error, but the other conditions still error.


Can you please use like this


And the class is RegularExpressions you missed a ‘S’ there


1 Like

Thanks @Anil_G! That was it, all fixed now :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.