Checking if one data from an excel matches another , then getting the crossponding value

@sherpa24

you cannot compare double and string values.
instead convert double value to string and then compare.
e.g : double value.ToString.Equals(string) use like this

Regards,
Mahesh

Hi ,

I am using select statement to match two datatables like
dt1.select([column1])= row(0).tostring)

But in this column1 is in Camel case letters and row(0) is in upper case.

What can I do to convert both the sides to either upper or lower case.

@jbijlani

Then Better do like this

dt2=(From p in dt.Select
where p.Item("Column 1").Tostring.ToUpper.Equals(row(0).ToString.ToUpper)
Select p).ToArray.CopyToDataTable

Regards,
Mahesh

Thanks Mahesh , Its working:)

1 Like

Hi @arivu96,
Is there a way to add an index of the found matched rows to the Datatable result or other output variable?

I can get all rows from DT1 that match DT2 based on a certain column and output these matched rowed as a Datatable as you suggested.
However, I need to update certain cells in matched rows in DT2 with the values from DT1. Which means that I need to know the index of the found matched rows of DT2 to write the values there.
I’d be grateful for the suggestion.
regards
Anna

@AnnaV
Declaration
Lista- List of Strings.

Lista= (From P in DT2.Select
          where (From q In DT1.Select where p.Item("Column Name").ToString.Equals(q.Item("Column Name").ToString
Select q).ToArray.Count>0
Select Convert.ToString(DT2.Rows.IndexOf(P))).ToList

List A will COntain the Index of rows of DT2 which got matched with DT1

Regards,
Mahesh

thanks for the quick reply.
Sorry, it might be a stupid question but… Do I write it in Assign activity?

@AnnaV
Yes.

Regards,
Mahesh

Very helpful! A couple of notes:

  1. Make sure at the end you use “length” of “lenth” above

  2. If you have a space in your column name put it in braces the first time it is listed in the condition statement
    Example:
    Dt2.Select(“[column 1]= '”+row(“column 1”).Tostring()+“'”).length>0

Thanks so much for posting this!!!

hi i also want the excel files could u please provide…

hi can u provide those 2 excel files please…

it will help me.

Hi All,

I also have the same condition but the only difference is i want to select the corresponding value from the same datatable.
I tried the above solution but didn’t worked.

can u share workflow of this