# Named query does not accept empty string parameters

**URL:** <https://forum.inductiveautomation.com/t/named-query-does-not-accept-empty-string-parameters/57598>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [March 24, 2022, 4:04pm UTC](https://forum.inductiveautomation.com/t/named-query-does-not-accept-empty-string-parameters/57598 "2022-03-24T16:04:46Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![zzeng2](https://avatars.discourse-cdn.com/v4/letter/z/3bc359/32.png) [@zzeng2](https://forum.inductiveautomation.com/u/zzeng2)\
**Post date:** [March 24, 2022, 4:04pm UTC](https://forum.inductiveautomation.com/t/named-query-does-not-accept-empty-string-parameters/57598/1 "2022-03-24T16:04:46Z")

</div>

I have a named query that has a where clause that looks like below:

WHERE  
title like ‘%{titleContains}%’

and titleContains is a QueryString. This clause looks for title that contains the string titleContains. I am expecting the clause to not filter anything when an empty string is passed in. But named query will give an error if titleContains is an empty string:

Missing value for query parameter titleContains

I think this is a bug that needs to be fixed.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [March 24, 2022, 4:10pm UTC](https://forum.inductiveautomation.com/t/named-query-does-not-accept-empty-string-parameters/57598/2 "2022-03-24T16:10:03Z")

</div>

For like clauses I don’t use a query string and would do it like

`WHERE title CONCAT('%', :title, '%')` where title is a string parameter. If you do it this way does that fix your issue?

---

<div class="post-metadata">

**Author:** ![zzeng2](https://avatars.discourse-cdn.com/v4/letter/z/3bc359/32.png) [@zzeng2](https://forum.inductiveautomation.com/u/zzeng2)\
**Post date:** [March 24, 2022, 4:26pm UTC](https://forum.inductiveautomation.com/t/named-query-does-not-accept-empty-string-parameters/57598/3 "2022-03-24T16:26:20Z")

</div>

thanks for the quick response, it does work for me.  
but I do want to see whether admins would consider allowing passing empty QueryString type parameter.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [March 24, 2022, 4:31pm UTC](https://forum.inductiveautomation.com/t/named-query-does-not-accept-empty-string-parameters/57598/4 "2022-03-24T16:31:39Z")

</div>

How are you feeding the parameter to the named query? Are you sure its going through as an empty string and not potentially as a `None` which I think would translate to a `NULL`?

---

<div class="post-metadata">

**Author:** ![zzeng2](https://avatars.discourse-cdn.com/v4/letter/z/3bc359/32.png) [@zzeng2](https://forum.inductiveautomation.com/u/zzeng2)\
**Post date:** [March 24, 2022, 4:41pm UTC](https://forum.inductiveautomation.com/t/named-query-does-not-accept-empty-string-parameters/57598/5 "2022-03-24T16:41:24Z")

</div>

I am feeding the empty string through two places:

1. I leave it blank in the testing page for named queries
2. I leave it blank in the query binding page  
in both cases, I got the same error

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [March 24, 2022, 4:43pm UTC](https://forum.inductiveautomation.com/t/named-query-does-not-accept-empty-string-parameters/57598/6 "2022-03-24T16:43:55Z")

</div>

Ok fair enough. What is the error that you get?

---

<div class="post-metadata">

**Author:** ![zzeng2](https://avatars.discourse-cdn.com/v4/letter/z/3bc359/32.png) [@zzeng2](https://forum.inductiveautomation.com/u/zzeng2)\
**Post date:** [March 24, 2022, 4:45pm UTC](https://forum.inductiveautomation.com/t/named-query-does-not-accept-empty-string-parameters/57598/7 "2022-03-24T16:45:59Z")

</div>

missing value for query parameter {titleContains}

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 24, 2022, 4:47pm UTC](https://forum.inductiveautomation.com/t/named-query-does-not-accept-empty-string-parameters/57598/8 "2022-03-24T16:47:41Z")

</div>

Try feeding a single space in those cases.

---

<div class="post-metadata">

**Author:** ![zzeng2](https://avatars.discourse-cdn.com/v4/letter/z/3bc359/32.png) [@zzeng2](https://forum.inductiveautomation.com/u/zzeng2)\
**Post date:** [March 24, 2022, 4:48pm UTC](https://forum.inductiveautomation.com/t/named-query-does-not-accept-empty-string-parameters/57598/9 "2022-03-24T16:48:05Z")

</div>

I actually tried that, it worked that way

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [March 24, 2022, 4:49pm UTC](https://forum.inductiveautomation.com/t/named-query-does-not-accept-empty-string-parameters/57598/10 "2022-03-24T16:49:16Z")

</div>

Is there a reason that it needs to be a QueryString and not a parameter?

---

<div class="post-metadata">

**Author:** ![zzeng2](https://avatars.discourse-cdn.com/v4/letter/z/3bc359/32.png) [@zzeng2](https://forum.inductiveautomation.com/u/zzeng2)\
**Post date:** [March 24, 2022, 4:52pm UTC](https://forum.inductiveautomation.com/t/named-query-does-not-accept-empty-string-parameters/57598/11 "2022-03-24T16:52:25Z")

</div>

No, not after seeing the solution provided by @bkarabinchak.psi. Now I am just curious why it wouldn’t allow empty string in a QueryString type parameter.  
I initially used QueryString because that gives me similar syntax to a vision query binding. Now I am switching to perspective and I have to use a named query.
