Query Tag Error

Can somebody please tell why in the world this query tag isn’t working? I’m stumped.

SELECT quantity
FROM mill_workorders
WHERE po = {[.]ReportPO} and style = {[.]ReportStyle}

Error evaluating tag: Unknown column '0731514KP' in 'where clause'

the 0731514KP is the tag value for ReportStyle, which isn’t a column in the db, style is the column. Why does it think the tag is the column name and not style? the po condition works fine. So confused…

Try:

SELECT quantity
FROM mill_workorders
WHERE po = {[.]ReportPO} and style = '{[.]ReportStyle}'

Query tags fill in values directly, before sending the query to the DB, so your statement is getting sent to the database as:

SELECT quantity
FROM mill_workorders
WHERE po = 12345 and style = 0731514KP

The PO probably works because it’s a number, which SQL doesn’t require you to escape - but it thinks you’re referring to another column with 0731514KP because it’s not wrapped in single quotes.

I thought about that, but I figured it would try to match it as literally “{[.]ReportStyle}” instead of the tag value, but I guess that’s what the {} are for. Thanks

A post was split to a new topic: Query tag issue