# LINQ error?

**URL:** <https://forum.uipath.com/t/linq-error/395924>\
**Category:** Activities\
**Tags:** question, system, activities\
**Created:** [February 1, 2022, 1:36pm UTC](https://forum.uipath.com/t/linq-error/395924 "2022-02-01T13:36:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fairymemay](https://avatars.discourse-cdn.com/v4/letter/f/ecd19e/32.png) [@fairymemay](https://forum.uipath.com/u/fairymemay)\
**Post date:** [February 1, 2022, 1:36pm UTC](https://forum.uipath.com/t/linq-error/395924/1 "2022-02-01T13:36:38Z")

</div>

Now I use LINQ as below

```auto
InputDT.AsEnumerable.Where(Function(x)x(“สถานะ”).ToString.ToLower.Equals(“นำจ่ายสำเร็จ”) And CInt(x(“จำนวนวัน”).Tostring) >= 15 And x(“APSTS1”).ToString <> "FLFL" And DateTime.ParseExact(x(“Issue Date”).ToString.Trim,“yyyyMMdd”,System.Globalization.CultureInfo.InvariantCulture).AddYears(-543)<= ApproveDate AndAlso String.IsNullOrWhiteSpace(x(“Status”).ToString) And String.IsNullOrEmpty(x(“Chk Dup”).ToString.Trim)).ToArray

```

But some row in column จำนวนวัน as blank —\> So it can’t convert to int —\> error as below.  
 ![image](https://global.discourse-cdn.com/uipath/original/4X/2/b/9/2b9c1597c142cd0d01df386b7fc98e99c44c8133.png)

Please guide me for solve it.

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [February 1, 2022, 1:53pm UTC](https://forum.uipath.com/t/linq-error/395924/2 "2022-02-01T13:53:36Z")

</div>

Hi,

Probably it shows `CInt(x(“จำนวนวัน”).Tostring)` is failed due to x(“จำนวนวัน”).Tostring is empty (`""`).

Can you check contents of the column in your datatable?

Regards,

---

<div class="post-metadata">

**Author:** ![fairymemay](https://avatars.discourse-cdn.com/v4/letter/f/ecd19e/32.png) [@fairymemay](https://forum.uipath.com/u/fairymemay)\
**Post date:** [February 1, 2022, 1:54pm UTC](https://forum.uipath.com/t/linq-error/395924/3 "2022-02-01T13:54:59Z")

</div>

@Yoichi Yes, Some row in column จำนวนวัน is empty.

How to edit LINQ?

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [February 1, 2022, 1:59pm UTC](https://forum.uipath.com/t/linq-error/395924/4 "2022-02-01T13:59:46Z")

</div>

Hi,

Can you try to modify as the following?

from  
`CInt(x(“จำนวนวัน”).Tostring) >= 15`

to

```
((not String.IsNullOrEmpty(x(“จำนวนวัน”).Tostring)) AndAlso CInt(x(“จำนวนวัน”).Tostring) >= 15)

```

Regards,

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [February 4, 2022, 2:00pm UTC](https://forum.uipath.com/t/linq-error/395924/5 "2022-02-04T14:00:27Z")

</div>

Closed on February 4, 2022, 2:00pm UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
