IF condition error while using single boolean variable

Hi Guys,

row_main(0).ToString.Equals(“VESSEL:”) i am getting this from excel below is my flow and i have used single boolean variable for all the if conditions…here i am getting false for all the if conditions

i am getting false when i check in message box here but it goes to then loop

Thanks,
Suresh.

1 Like

@suresh_kumar4:

If a condition is false, the then loop is executed. Which is correct.

Only a true condition will result in the if block.

I think you need to check if the column does not contain VESSEL:

If so please try the condition:
Not row_main(0).ToString.Equals(“VESSEL:”)

Hi @suresh_kumar4,

If you’re expecting Then section to execute, then i’ll suggest you to use .Trim here aswell.
try following condition.

row_main(0).ToString.Trim.Equals(“VESSEL:”)

row_main(0).ToString might have leading Or exceeding white spaces.

Thanks but It does’nt works for me

Adding UpperCase if ever:

row_main(0).ToString.Trim.ToUpper.Equals(“VESSEL:”)

thanks for your reply if i use NOT i am getting true… but i have vessel in my column…

image

can you check whether the data in excel is in the same Case you used in the code.

COmparing sting are case sensitive. In order to pass the condition both has to be identical

@suresh_kumar4

Please use a Write Line activity with row_main(0).ToString and check what the result is. Kindly do this before the If block.

you can try these -

row_main(0).ToString.ToUpper.Equals(“VESSEL:”)

row_ConfiguFile(“VESSEL:”).ToString.ToLower.Equals((VesselText.ToLower.Trim()))

1 Like

you can log “row_main(0).ToString” this value before if condition and check what is the value and apply the conditions accordingly…

row_main(0).ToString.ToUpper.Equals(“VESSEL:”)

row_ConfiguFile(“VESSEL:”).ToString.ToLower.Equals((VesselText.ToLower.Trim()))

row_main(0).ToString.ToUpper.Equals(“VESSEL:”) problem is here

row_ConfiguFile(“VESSEL:”).ToString.ToLower.Equals((VesselText.ToLower.Trim())) this one is fine.

@suresh_kumar4 can you print the value in log and check what value you are getting in the row_main(0).ToString. because as per my understanding you are not getting any value over there that is the reason it’s failing.

Add a Log Message Activity before the If condition and write the value of row_main(0).ToString

@suresh_kumar4

I think the row you are trying to get the data from is not correct. Can you paste the screenshot of the for each row activity used on the dataTable.

i am not getting value you are right but value is there in excel.

From the excel screenshot I see the first row was blank.
VESSEL: is an entry in the second row.

1 Like

image it is ther in 7th row