# IF condition error while using single boolean variable

**URL:** <https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606>\
**Category:** Help\
**Tags:** workflow, condition, excel, error, system, activities\
**Created:** [February 10, 2020, 9:11am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606 "2020-02-10T09:11:49Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![suresh\_kumar4](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/suresh_kumar4/32/68322_2.png) [@suresh\_kumar4](https://forum.uipath.com/u/suresh_kumar4)\
**Post date:** [February 10, 2020, 9:11am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/1 "2020-02-10T09:11:49Z")

</div>

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

 ![image](https://global.discourse-cdn.com/uipath/original/3X/a/9/a91380dc1864ba58f7b10888d11ad7ab500ce2c4.png)

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

Thanks,  
Suresh.

---

<div class="post-metadata">

**Author:** ![SowmyaLeo](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sowmyaleo/32/109068_2.png) [@SowmyaLeo](https://forum.uipath.com/u/SowmyaLeo)\
**Post date:** [February 10, 2020, 9:17am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/2 "2020-02-10T09:17:49Z")

</div>

@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:”)

---

<div class="post-metadata">

**Author:** ![samir](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/samir/32/84380_2.png) [@samir](https://forum.uipath.com/u/samir)\
**Post date:** [February 10, 2020, 9:18am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/3 "2020-02-10T09:18:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![suresh\_kumar4](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/suresh_kumar4/32/68322_2.png) [@suresh\_kumar4](https://forum.uipath.com/u/suresh_kumar4)\
**Post date:** [February 10, 2020, 9:22am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/4 "2020-02-10T09:22:09Z")

</div>

Thanks but It does’nt works for me

---

<div class="post-metadata">

**Author:** ![Emman\_Pelayo](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/emman_pelayo/32/33711_2.png) [@Emman\_Pelayo](https://forum.uipath.com/u/Emman_Pelayo)\
**Post date:** [February 10, 2020, 9:24am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/5 "2020-02-10T09:24:14Z")

</div>

Adding UpperCase if ever:

**row\_main(0).ToString.Trim.ToUpper.Equals(“VESSEL:”)**

---

<div class="post-metadata">

**Author:** ![suresh\_kumar4](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/suresh_kumar4/32/68322_2.png) [@suresh\_kumar4](https://forum.uipath.com/u/suresh_kumar4)\
**Post date:** [February 10, 2020, 9:24am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/6 "2020-02-10T09:24:46Z")

</div>

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

![image](https://global.discourse-cdn.com/uipath/original/3X/e/f/ef68cd6d665e81b999b8ecb11fc2bd4c8024a2a1.png)

---

<div class="post-metadata">

**Author:** ![suresh\_kumar4](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/suresh_kumar4/32/68322_2.png) [@suresh\_kumar4](https://forum.uipath.com/u/suresh_kumar4)\
**Post date:** [February 10, 2020, 9:26am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/7 "2020-02-10T09:26:25Z")

</div>

![image](https://global.discourse-cdn.com/uipath/original/3X/a/b/ab22ca5dd4872f2152b282ce5de187ae28f89802.png)

---

<div class="post-metadata">

**Author:** ![MuralidharVankamaddi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/muralidharvankamaddi/32/180917_2.png) [@MuralidharVankamaddi](https://forum.uipath.com/u/MuralidharVankamaddi)\
**Post date:** [February 10, 2020, 9:26am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/8 "2020-02-10T09:26:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SowmyaLeo](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sowmyaleo/32/109068_2.png) [@SowmyaLeo](https://forum.uipath.com/u/SowmyaLeo)\
**Post date:** [February 10, 2020, 9:26am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/9 "2020-02-10T09:26:43Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![GBK](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gbk/32/142274_2.png) [@GBK](https://forum.uipath.com/u/GBK)\
**Post date:** [February 10, 2020, 9:30am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/10 "2020-02-10T09:30:00Z")

</div>

> [@suresh\_kumar4](#):
>
> row\_main(0).ToString.Equals(“VESSEL:”)

you can try these -

> row\_main(0).ToString.ToUpper.Equals(“VESSEL:”)

> row\_ConfiguFile(“VESSEL:”).ToString.ToLower.Equals((VesselText.ToLower.Trim()))

---

<div class="post-metadata">

**Author:** ![suresh\_kumar4](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/suresh_kumar4/32/68322_2.png) [@suresh\_kumar4](https://forum.uipath.com/u/suresh_kumar4)\
**Post date:** [February 10, 2020, 9:30am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/11 "2020-02-10T09:30:28Z")

</div>

![image](https://global.discourse-cdn.com/uipath/original/3X/e/a/ea155378432f8a3df087390026b5f61cf73d9a81.png)

---

<div class="post-metadata">

**Author:** ![GBK](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gbk/32/142274_2.png) [@GBK](https://forum.uipath.com/u/GBK)\
**Post date:** [February 10, 2020, 9:32am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/12 "2020-02-10T09:32:12Z")

</div>

> [@GBK](#):
>
> row\_main(0).ToString

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()))

---

<div class="post-metadata">

**Author:** ![suresh\_kumar4](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/suresh_kumar4/32/68322_2.png) [@suresh\_kumar4](https://forum.uipath.com/u/suresh_kumar4)\
**Post date:** [February 10, 2020, 9:33am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/13 "2020-02-10T09:33:03Z")

</div>

**row\_main(0).ToString.ToUpper.Equals(“VESSEL:”)** problem is here

**row\_ConfiguFile(“VESSEL:”).ToString.ToLower.Equals((VesselText.ToLower.Trim()))** this one is fine.

---

<div class="post-metadata">

**Author:** ![vijaybrijmohan14](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vijaybrijmohan14/32/55375_2.png) [@vijaybrijmohan14](https://forum.uipath.com/u/vijaybrijmohan14)\
**Post date:** [February 10, 2020, 9:34am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/14 "2020-02-10T09:34:04Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![GBK](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gbk/32/142274_2.png) [@GBK](https://forum.uipath.com/u/GBK)\
**Post date:** [February 10, 2020, 9:34am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/15 "2020-02-10T09:34:37Z")

</div>

> [@suresh\_kumar4](#):
>
> row\_main(0).ToString

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

---

<div class="post-metadata">

**Author:** ![SowmyaLeo](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sowmyaleo/32/109068_2.png) [@SowmyaLeo](https://forum.uipath.com/u/SowmyaLeo)\
**Post date:** [February 10, 2020, 9:36am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/16 "2020-02-10T09:36:36Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![suresh\_kumar4](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/suresh_kumar4/32/68322_2.png) [@suresh\_kumar4](https://forum.uipath.com/u/suresh_kumar4)\
**Post date:** [February 10, 2020, 9:40am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/17 "2020-02-10T09:40:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![suresh\_kumar4](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/suresh_kumar4/32/68322_2.png) [@suresh\_kumar4](https://forum.uipath.com/u/suresh_kumar4)\
**Post date:** [February 10, 2020, 9:41am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/18 "2020-02-10T09:41:04Z")

</div>

![image](https://global.discourse-cdn.com/uipath/original/3X/e/a/ea4d0fc3f3b3359e10b732820db88769c70a9313.png)

 ![image](https://global.discourse-cdn.com/uipath/original/3X/b/8/b83f14e79c0ae24155f41f8c9d9277dcdad2b240.png)

 ![image](https://global.discourse-cdn.com/uipath/original/3X/1/0/10ed3ec5aebe44fb3d87a7f9ba146c617f3a99c6.png)

---

<div class="post-metadata">

**Author:** ![SowmyaLeo](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sowmyaleo/32/109068_2.png) [@SowmyaLeo](https://forum.uipath.com/u/SowmyaLeo)\
**Post date:** [February 10, 2020, 9:43am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/19 "2020-02-10T09:43:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![suresh\_kumar4](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/suresh_kumar4/32/68322_2.png) [@suresh\_kumar4](https://forum.uipath.com/u/suresh_kumar4)\
**Post date:** [February 10, 2020, 9:44am UTC](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606/20 "2020-02-10T09:44:29Z")

</div>

![image](https://global.discourse-cdn.com/uipath/original/3X/f/e/fe11db055676d6c2aca90c227b88114069321c8a.png) it is ther in 7th row

[Next page](https://forum.uipath.com/t/if-condition-error-while-using-single-boolean-variable/192606.md?page=2)
