Bind Named Query Parameter to Tag

Is it possible in a Named Query to bind a parameter to a tag?

select job_number as Job, :State as State
from jobs

but for each job_number have the query go to each tag and grab its state?

So say for example a tag looked like this: Job/Job 1/State.value.
For the first job_number in the query, 1, it would need to traverse the tag the Job/Job 1/State.value and get that state.value.
For reference the query would only return integers:

Job State
1 0
2 1
3 0

Yes.

When you use a Named Query Binding, you can use an expression to set the value of the parameter.

This is not possible though, as @pturmel has pointed out.

You'll have to run the query to get data from the database, and then use a script transform (as has been shown in other posts) to add the tag data.

EDIT: Added some clarification.

1 Like

No. Your database is running the query. It knows nothing about Ignition tags.

1 Like

Yeah I see why that wouldn’t work now since the query would not return any data until it has finished executing. Thanks for the clarification @pturmel and @lrose. I’ll have to try a transform to get the additional data I need, just haven’t had any luck with that yet.