Check if particular text available in DT

ExportData.xlsx (9.7 KB)

image

Above data will be available in DT format. BOT needs to check if “checked” text is available in anyone of the row in DT. If the “checked” text in any of the row then pass the value to variable as “Yes” else No

Attached DT data in excel format

Hi @Sathish_Kumar_S

Try this:

Read Range activity (Output: dt)

If dt.AsEnumerable().Any(Function(row) row("Column-7").ToString().ToLower() = "checked") Then
    resultVariable = "Yes"
Else
    resultVariable = "No"

Hope it helps!!

Checking within a particular col in all rows

Assign Activity:
hasFound | DataType: Boolean =

(From d in dtData.AsEnumerable
Let v = d("YourColName")
Where not isNothing(v)
Where v.ToString.Trim.ToUpper().Equals("CHECKED")
Select r = d).Any

Hi @Sathish_Kumar_S

Take Read Range Activity = Output DT as DataTable
Take IF Activity and use below expression in Condition.
DT.AsEnumerable.Any(Function(x) x(“Column-7”).ToString.Trim.Equals(“checked”))

For Reference you can check below image.

Hope it will helps you :slight_smile:
Cheers!!

Hi @Sathish_Kumar_S

Use read range workbook activity to read the excel and store in a datatable.
Create a variable called Status.
After that use for each row in datatable activity to iterate the each row in datatable. Inside for each insert the If condition to check the condition.

- If Condition -> CurrentRow("Column-7").equals("checked")

Insert an assign activity inside the then block, and assign Yes to the Variable.

- Assign -> Status = "Yes"

Insert an assign activity inside the else block, and assign No to the Variable and Insert break activity after assign activity.

- Assign -> Status = "No"

Check the below workflow for better understanding,

Hope it helps!!

Hi @Sathish_Kumar_S

checkedStatus = “No”

For Each row In DataTable
If row(0).ToString.ToLower.Trim.Equals(“checked”)
The
checkedStatus = “Yes”
Else
checkedStatus = “No”

Hi @Sathish_Kumar_S

Read Range activity (Output: dt)

If dt.AsEnumerable().Any(Function(row) row("Column-7").ToString().ToLower() = "checked") Then
    resultVariable = "Yes"
Else
    resultVariable = "No"

Check the below image for better understanding.

Regards,