Condition under if is not working

Hi Folks,

i have some scraped data(like Name, initials ,department etc) and i m trying to match with exceldb but did not produce the desired result.

Any suggestions?

image

note- i am not getting “messagebox” printed.

1 Like

Hey @Rakesh_Tiwari,

Your condition is failing.

Print the values before if. sInitials & row(“INIT”).ToString - similarly for others.

The strings may not be the same when you receive. It may vary based on case spaces as well.

This will help debug and resolve the issue. If you can’t still post here.

Thanks :slight_smile:

1 Like

Hi Nithin,

Thanks for quick reply,

Actually i tried printing the values using msgbox and it was correct.

1 Like

hi @Rakesh_Tiwari

when you are comparing the extracted text with excel , make sure the text convert into .Tolower to avoid the case sensitivity

thanks…

@Rakesh_Tiwari,

Could you please show me the output string and please try with only one condition in if first please

Thanks :slight_smile:

1 Like

image

1 Like

It is not working because there is a difference in upper case and lower case of letters convert your second string to upper case using .upppercase function and then it should work.

Cheers,
Parth

1 Like

In the IF condition you use, please optimize the condition as below.

sInitials.Trim.ToLower.Equals(row(“INIT”).ToString.Trim.ToLower)

Similarly for other cases as well.

Thanks :slight_smile:

Is your problem solved? @Rakesh_Tiwari

image

what mistake i am doing?

i used below code, but getting error.

Just use And don’t use AndAlso and check @Rakesh_Tiwari

Also, you’re missing a ) bracket for INIT the ver first statement @Rakesh_Tiwari

Hi @Parth_Doshi,

i changed with “And” only and given the ), but still error.

image

1 Like

Since you are missing few syntax standards. ( And. AndAlso - anything is fine as per your need)

Could you please paste the entire condition here in text format.

I will rectify it and post back

May be easy for you

Thanks :slight_smile:

1 Like

How many total numbers of time are you getting the error on implicit conversion string to boolean? @Rakesh_Tiwari

sInitials.Trim.ToLower.Equals(row(“INIT”).ToString.Trim.ToLower) And
sNames.Trim.ToLower.Equals(row(“FirstName”).ToString.Trim.ToLower) And
sDepartment.Trim.ToLower.Equals(row(“DepartmentNumber”).ToString.Trim.ToLower) And
sRole.Trim.ToLower.Equals(row(“JobTitle”).ToString.Trim.ToLower) And
sManager.Trim.ToLower.Equals(row(“Manager”).ToString.Trim.ToLower) And
sNNinitials.Trim.ToLower.Equals(row(“NNInitials”).ToString.Trim.ToLower)

Please compare now or copy this

Thanks :slight_smile:

2 times and now it is showing string to Long.

Hi,
thanks the error is gone ,but still not executing the msgbox.

1 Like