Contains is not a member of datatable

Hey there,

I would like to read the whole excel sheet, and set if “2021” is identified, log a message.
May I know what should I put under if condition to correct the error in the screenshot?

use an output datatable activity after read range and then check the same condition

Regards,

Hey @WS_Chai , use a for each row in datatable and inside the activity u can use an if condition as
Currentrow(0).tostring.contains("2021")

Hope it helps you!

@B_H_Akshatha_Pai,

Thanks for your prompt guidance.
Do you mean this? I have set this earlier but it is not working.

@WS_Chai
i meant output datatable activity , since it would convert datatable into string

Output :
Screenshot (59)

xaml :
Main.xaml (8.0 KB)

check this out

Hi @WS_Chai

Use For Each Row in Data Table to iterate through the Data Table Dt and in if condition you can give the below condition:
CurrentRow("Column Name").ToString.Contains("2021")

Hope it helps!!

@WS_Chai , Below is the screenshot and xaml file for your reference


Contains_test.zip (10.2 KB)

hope it helps you

@B_H_Akshatha_Pai,

It works! In the log message, I put sheetname.ToString + " contains ABC", it works perfectly.
However, I would like to add the cell address in the log message to see where the value is located within the sheet.

Do you mind to guide me what activities should I add to get the cell address too?

Glad it helped you !

For cell address you can use “look up range” activity it returns cell address

[How to get the cell address of a specific value in datatable]

Output :
Screenshot (63)

Xaml :
Main.xaml (9.1 KB)

Check it out

You can try this
dt.AsEnumerable.Any(Function(x) x(“ColumnName”).ToString.Equals(“2021”)))

or
dt.AsEnumerable.Any(Function(x) x(“ColumnName”).ToString.Contains(“2021”))

@B_H_Akshatha_Pai,

Thank you, lemme try it out.

I have a problem, currently the value exists in “Sheet1”, the log message shows it correctly. I have a write range activity to record the sheetname.

However, as the process loops through, the value also exists in Sheet2. “Sheet2” then replaces “Sheet1”, I can’t see “Sheet1” anymore. I want to maintain all Sheet names instead of having one replaced by another.

Do you mind to guide me what shall I put under assign variable to store all sheetnames with the value found?

image

Try creating an array of sheet names

Regards,

@B_H_Akshatha_Pai,

I just changed the variable type. Did I do it correctly?

The type in variable pannel is array of string and .tostring is a single string , so either keep it as “string” in variable pannel

If you have multiple things then using “string[ ]” , if you have one thing use “string”

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