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


#1

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


#2

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


#3

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


#4

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


#5

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.


#6

Thanks… It’s working…


#7

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


#8

It is an array of DataRow data type.


#9

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