Compare multiple get text values from with excel..using if condition,,

Hello All,

I want to compare multiple values from web using (get text activity)…with excel columns
now i am using separate if condition for all the values.so i want to use only one if condition for all the values…

Thanks,
Suresh.

@suresh_kumar4
Are you trying to check if the values from the web is present in your excel sheet ?

yes your are correct

@suresh_kumar4
try using this inside the if condition. If the get text value is present in your excel sheet, it will return true and perform the “Then” part else it will perform the “Else” part
yourDT.AsEnumerable().Any(Function(x) x(“Column1”).ToString = GetTextValue)

Replace column1 with the excel column that you are comparing with.

Thanks understood…if i have one column let say column1 then its fine…here i have so many columns,
column1 = gettext1
column2 = gettext2
column3 = gettext3
column4 = gettext4…
so i want to compare this whole thing in single if conditon.

hope you understand…

Thanks,
Suresh.

1 Like

Fine
Let’s take like you are getting the text from web with GET TEXT ACTIVITY and is stored in a variable named strinput
—now use a OUTPUT DATATABLE activity and pass the datatable variable as input and get the output with a variable of type string named str_output
—now use a IF condition like this
str_output.ToString.Contains(str_input.ToString)
If true it will go to THEN part or goes to ELSE part

Cheers @suresh_kumar4

1 Like

Does your data contain comma?

If not, you can try this:

  • Combine all variable into 1 variable CombineString with comma delimiter
    Example: CombineString = var1 + “,” + var2 + “,” + var3 and so on.
  • Convert you Excel DataTable into String with Comma delimiter using Output Data Table

Finally use following code to check whether the data exists in excel or not.
ExcelDTString.Contains(CombineString)

Thanks for your reply… i am not getting it… can you please elaborate…

Thanks.

  1. I have a excel with column1, column2, column3,
  2. I am using the excel data to fill a form in the website
  3. After filled the form i submtted the form
    4.my submitted data will save in form field itself and there is a update button to update my form
  4. Now i have to compare web text with excel columns
  5. I am using get text activity to store my web text…let say gettextvar1…this is (usernametext),gettextvar2…this is (emailText),…like wise i have mulitple text fileds.
  6. i my excel my first column is username, 2nd column mailid,…
  7. i am comparing like row(“username”).equals(usernametext)…using if condition… this i know…
  8. Here i want to compare all columns with respectivite gettext values in single if conditon.
    i dont want to use separate if for all each and every comparison

Thanks,
Suresh.