Query Binding works in Vision, fails in Perspective

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)

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

Any suggestions would be appreciated!

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

image

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

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.

1 Like

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

2 Likes

Do not use query strings to pass dates!

Not date only for the table name.

1 Like

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.

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 ?

4 Likes

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").

6 Likes

@pascal.fragnoud and @PGriffith, 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! :slight_smile:

Thanks for your help!

2 Likes