Extract a specific value from a data table with a variable

I have a datatable with two columns and I have two string variables so I want to extract the data from the datatable that is equal to my strings and save them in another variable

this is my datatable
image

Help meee

1 Like

Hi there ,

First you have to use the “Read Range” activity then you use the “For each row” activity to compare the datatable values by row then you make a condition inside.

For example:

if NeededDate=row(“Fecha”).tostring
{
Number=row(“Numero”)
}

1 Like

Hi
Hope these steps would help you resolve this
—let’s take like we have two variables named str_value1 and str_value2
—now this excel is read with a read range activity and get the output with a variable of type datatable named dt
—now pass this datatable as input to for each row activity
—inside the loop use a IF condition like this
row(0).ToString.Contains(str_value1.ToString) AND row(1).ToString.Contains(str_value2.ToString)

This condition will check for two column values and compare with those two variables
If they match it will go to THEN part where we can use two string variables to store those two column values

Cheers @Ivan_torres_oliva

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