Checking 1 column for string

Hi UiPath,

I need help with my problem.

Let say I have the Table below:

As you can see in the column Status, 2 rows are in pending and one row have string “Release”.

My goal is to check if all rows in this datatable contains the string “Release” in all the row in column Status without using for loop.

Is it feasible?

Thanks!

You can first read the excel file
Then convert data table to string using output data table
And then check the condition, if “data table name”.contains(“released”), then do this.
And I guess your problem will be solved

Regards:

Hafiz Mohammad Ahsan

Hi @hafiz.ahsan Thank you for your response. However I would like to check if all rows have the String Release. not if the string is present in the data table. thanks!

Hi @alvin.c.apostol26 ,
in general we can use the output datatable activity for getting a string representation

With LINQ we can do

String.Join(Environment.newLine, dtVar.AsEnumerable.Select(Function (x) String.Join(“|”, x.ItemArray)))

Thanks & Regards,
Shubham Dutta

Hello @alvin.c.apostol26 ,

Use the below Linq to achieve this

(TestDt2.AsEnumerable.All(function(x) x(“Status”).ToString.Trim.Contains(“Release”)))

This will return you True if all the rows contain “Release” string in Status column else it will return false.

Regards,
Rohith

1 Like

@rohith.prabhu thank you so much! your answer worked!

Marking this as the solution :smile:

1 Like

use filter data table in which provide the Status column and used operation Contains and in value give “Pending”.

If the table is blank(dt.rows.count=0 or dt is nothing) then you can say that only Release is present.

The solution only applicable if only two values are used in Status column.

@alvin.c.apostol26
Try this ,

image
image

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