Problems in comparing values

Hello friends,
I need to compare two values, one saved in the column "AGENZIA of the Excel Sheet
Agenzie Monitorate.xlsx (17.0 KB)
and the other one saved from another workflow.
For example I have the case in which the variable extracted is “000425”, which is also present in the column AGENZIA of the Excel sheet.
If I compare the two strings the result is always false.
How can I resolve this problem?
Thank you so much.
Camilla.

Hi @CamiCat,

While checking it in your condition use .ToLower() with both strings then compare it.

In the excel it is saved as Text property, in the workflow how you have it.

Both the cases it should be string or convert to Integer before compare.

1 Like

I tried your solution but it doesn’t work.
How is it possible to check if a string is present in an Excel COlumn?
Thank you so much,
Camilla :slight_smile:

Hi,

Read the excel file as datatable, then have the following code in the “invoke code” activity.
Pass the required arguments to check and this function will return with True or False value.

Input Parameters:
myTable As DataTable,
columnName1 As String,
searchValue1 As String

Output Parameters:
valueExists As Boolean

Invoke Code:
For Each row As DataRow In myTable.Rows
If row(columnName1) = searchValue1 Then Return True
Next
Return False

1 Like

and you can loop though your data table and while comparing the values convert row.item and as well as other value to .toString().ToLower()

1 Like

Hi @CamiCat,
I have done the solution for your situation. But for me it is working fine the comparison. I don’t know the real problem of your situation. But Here I have attached the source what I have tried.

File :comparingvalues.zip (16.1 KB)

Regards
Balamurugan.S

1 Like

Thank you so much @balupad14.
You helped me in a successful way.
Thank you so much,
Camilla :slight_smile:

You are always welcome @CamiCat :slight_smile:

Balamurugan.S

1 Like