Check whether a particular number is present in Data table or not

Search for a particular number in data table ,If found return that value or a Boolean value.How to achieve this

Do you want to check in any particular column or complete data table.
Is the number is a part of text or full text.

Regards,
Karthik Byggari

That number is in first column and data table will have only one column.That number is full text only:
Eg:12345
Need to check whether 12345 is present in data table first column or not

Hey @ndivya

you can get with below code:-

bool ValueExists = YourDatatableName.AsEnumerable().Any(function(row) valueToSearch = row.Field(Of String)(“Column1”))

Find attached sample and let me know :slight_smile:
nDivyasAmpleDtColValSearch.xaml (7.9 KB)

Regards…!!
Aksh

1 Like

Use Assign Activity -

if number is stored in an variable and type is Integer
dataRowsArray = YourDataTable.Select(“Column1=” + SearchNumber)

If number is stored as a string
dataRowsArray = YourDataTable.Select(“Column1=” + “'” + SearchNumber + “'”)

if dataRowsArray.Length > 0 then number is found else not found.

1 Like

Thanks… It’s working…

If i consider datarowarray as an array then type conversion error populated

It is an array of DataRow data type.

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