How can I check same value is in defined column of data table or not

fig shows table from SAP window.and I use data scrapping and store this table in data table.

Now I want to check in status column… whether all status is “Contract ended” or not. If all are contract ended I will take further action …but how can I check that…

I use for each row activity .inside that I used if condition

I used this …I don’t know is this correct or not…

how can I get status if all lines are Contract ended… and if yes…how can take further action on that(means in loop or outside)

Please provide solution with screenshots for my better understanding as am new in RPA.

Use Filter Datatable to remove everything that is “Contract Ended” - then if any rows are left you’ll know some aren’t “Contract Ended” and can loop through just those.

Hi @rutuja.y ,

I think you almost achieved your requirement.

Pls don’t add any logic in the if condition inside for each row loop. Instead just use one assign activity in then section and else use one assign activity.

If your condition

Create string variable ContractEndedFlag

Then → ContractEndedFlag = “YES”

Else → ContractEndedFlag = “No”

And add break condition also in the else part to make sure other than contract ended status we have to come out of the loop

For each row loop will check for all the status whether contract ended or not.

Now use one if condition outside of for each row loop

If condition would be ContractEndedFlag = “YES”

Then → it means that all the stauses are contract ended do your operations accordingly

Else → your business exception whatever related to co tract not ended.

Sorry I am not able to share screenshot since sending message from my mobile. I hope you understood my suggestion. Please try to follow the steps and let us know. Thanks.

But what is the condition in if condition of for each loop…I assign flag in then and else part…but without applying condition it shows error.


Check below for your reference

Check Value using For Each
Check Value using Filter Datatable
Check value using LinQ

Hope this will help you



Keep your condition for your if condition in inside for each row loop

And follow my suggestion in the inside of the consdition and add one more if in the outside for each loop to understand whether we got all contract ended or not

See the error and what is if condition

I have done with all the steps as per your suggestion…but what I’m don’t understand is …as you say

As per this I have assign flag in then and else part in for each loop using if.

But what is the condition for that… without that it will show error

Correct me if I’m wrong

I also added one if statement outside the for each loop…and this is correct

But what can I do with if statement inside for each loop(what is condition I have to apply)


you almost done. use the below condition in the if condition inside for each loop

row(“Status”).tostring.Equals(“Contract Ended”)

Now the flow having capability tell us if the rows having only Contract Ended it will throw Yes after the loop so out side if condition you can have the subsequent flows.

i hope you understood this time.

Thanks for your support :blush:

1 Like

your most welcome :slight_smile:

1 Like

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