How to read one specific value from a datatable (into a string variable & not array of datarows)

Hi guys,
I need to look up in an excel which has list of Trader’s email ids. I have a email id in a variable, if i find same email id in the excel, i want to pull the value. now when i know its one unique value i dont want the output in array of datarows but just into one string variable. how do i achieve this. Pls help

Thanks in advance.

I have a small query her buddy
Like you mean you know one value stored in a variable
And you want to search that value along a particular column and get another columns corresponding value as output
Is it so

In that case we can use LOOKUP DATATABLE activity

Kindly correct me if I am wrong with the question
Cheers @Rani1978

yes Palaniyappa, I want to validate the value i have in a variable, if i find same value in the excel, than its correct value. how to use “Lookup datatable” activity, is there any help on it.


1 Like

To simply validate whether that variable and its value is there in the datatable or not we can do one simple thing without LOOKUP DATATABLE activity

That is use a EXCEL APPLICATION SCOPE and pass the file path as input
—inside the scope use read range activity and get the output with a variable of type datatable named dt

—now use a OUTPUT DATATABLE activity and pass the variable dt as input and get the output with a variable of type string named strinput

—now use a IF condition like this

If true it will go to then or to else part


If we want to validate along a particular column then use a condition in IF activity like this

dt.AsEnumerable().Where(Function(a) a.Field(of string)(“yourcolumnname”).ToString.Contains(yourvariableName)).Count>0

If true it will go to then or to else part

Cheers @Rani1978

1 Like

Thanks a zillion @Palaniyappan for providing a quick solution.
It really helped.

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