# Query Binding works in Vision, fails in Perspective

**URL:** <https://forum.inductiveautomation.com/t/query-binding-works-in-vision-fails-in-perspective/78491>\
**Category:** Ignition\
**Tags:** perspective, vision\
**Created:** [August 29, 2023, 4:14am UTC](https://forum.inductiveautomation.com/t/query-binding-works-in-vision-fails-in-perspective/78491 "2023-08-29T04:14:50Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![MCC](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@MCC](https://forum.inductiveautomation.com/u/MCC)\
**Post date:** [August 29, 2023, 4:14am UTC](https://forum.inductiveautomation.com/t/query-binding-works-in-vision-fails-in-perspective/78491/1 "2023-08-29T04:14:51Z")

</div>

I am puzzling over a parameterized named query that works fine in Vision query bindings, but fails as a query binding on the data property of a Perspective table. The error shows

> syntax error on token: 'End of Expression' (Line 0 Character 0)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/d/2d5271153f8a025097904688d3b024ec696b6e42.png)

The binding looks the same to me in Vision and populates the table with the expected results.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/3/a3fad092a51982a1b5d9567754fb6da21fa86446.png)

Any suggestions would be appreciated!

---

<div class="post-metadata">

**Author:** ![Priyanka.Khandge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/priyanka.khandge/32/35989_2.png) [@Priyanka.Khandge](https://forum.inductiveautomation.com/u/Priyanka.Khandge)\
**Post date:** [August 29, 2023, 5:14am UTC](https://forum.inductiveautomation.com/t/query-binding-works-in-vision-fails-in-perspective/78491/2 "2023-08-29T05:14:12Z")

</div>

In your query in where condition only two parameters and you passed three parameters.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/6/e64f0dc6c8639b7792c0bd54ce46ac3192306237.png)

and when you pass the table name using the parameter then select type **QueryString** not a **value**

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/9/b9ca9d46c26c35ce2312baace18c63fd296fe8c5.png)

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [August 29, 2023, 10:11am UTC](https://forum.inductiveautomation.com/t/query-binding-works-in-vision-fails-in-perspective/78491/3 "2023-08-29T10:11:59Z")

</div>

You shouldn't need to pass in the parameter you call "tbl" as you don't use it in either query.

I would test your actual values and make sure SQL can handle them. If I had to guess the format of your dates is different in Perspective versus Vision.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [August 29, 2023, 10:23am UTC](https://forum.inductiveautomation.com/t/query-binding-works-in-vision-fails-in-perspective/78491/4 "2023-08-29T10:23:09Z")

</div>

You're getting an `Error_Configuration`, which means the error is not in the query but in how you're getting the parameters.

In this case, I'm guessing removing the 3rd parameter will fix it. Because the value you passed it is not actually a string.  
Either remove it or quote the value to make it a string (`"Batches"` instead of `Batches`).

---

<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:** [August 29, 2023, 12:12pm UTC](https://forum.inductiveautomation.com/t/query-binding-works-in-vision-fails-in-perspective/78491/5 "2023-08-29T12:12:58Z")

</div>

> [@Priyanka.Khandge](#):
>
> then select type **QueryString** not a **value**

Do **not** use query strings to pass dates!

---

<div class="post-metadata">

**Author:** ![Priyanka.Khandge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/priyanka.khandge/32/35989_2.png) [@Priyanka.Khandge](https://forum.inductiveautomation.com/u/Priyanka.Khandge)\
**Post date:** [August 29, 2023, 12:14pm UTC](https://forum.inductiveautomation.com/t/query-binding-works-in-vision-fails-in-perspective/78491/6 "2023-08-29T12:14:09Z")

</div>

Not date only for the table name.

---

<div class="post-metadata">

**Author:** ![MCC](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@MCC](https://forum.inductiveautomation.com/u/MCC)\
**Post date:** [August 29, 2023, 3:43pm UTC](https://forum.inductiveautomation.com/t/query-binding-works-in-vision-fails-in-perspective/78491/7 "2023-08-29T15:43:39Z")

</div>

Thanks for the responses. It doesn't have to do with the extra parameter as that is unused and I have experimented with and without it. I think bmeyers is on the right track with date formats. I'll do some more experimenting.

Thanks again.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [August 29, 2023, 3:48pm UTC](https://forum.inductiveautomation.com/t/query-binding-works-in-vision-fails-in-perspective/78491/8 "2023-08-29T15:48:13Z")

</div>

> [@pascal.fragnoud](#):
>
> You're getting an `Error_Configuration`, which means the error is not in the query but in how you're getting the parameters.

Doesn't matter if it's used or not, if it's ill-formed, it will raise an `Error_Configuration`.  
Did you even try to put the quotes ?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 29, 2023, 4:03pm UTC](https://forum.inductiveautomation.com/t/query-binding-works-in-vision-fails-in-perspective/78491/9 "2023-08-29T16:03:41Z")

</div>

It's 100% the quotes, as Pascal suggested.

In Vision, query bindings accept property references or literal strings, _not_ true expressions.

In Perspective, instead of implementing "one-off" not-quite-expression contexts, basically everything that can accept a property reference _is just an expression_. So you **have** to have a valid expression. `Batch` is _not_, because there's no such keyword `Batch` in the expression language parser. You _must_ wrap it in quotes to make a 'real' expression (a string literal `"Batch"`).

---

<div class="post-metadata">

**Author:** ![MCC](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@MCC](https://forum.inductiveautomation.com/u/MCC)\
**Post date:** [August 30, 2023, 3:00pm UTC](https://forum.inductiveautomation.com/t/query-binding-works-in-vision-fails-in-perspective/78491/10 "2023-08-30T15:00:31Z")

</div>

@pascal.fragnoud and @paul-griffith, you guys were right. I could have sworn that I had already tried adding quotes in one of my permutations, but I must have had something else wrong when I did. I should remember to only modify one variable at a time in an experiment! 🙂

Thanks for your help!
