Is it possible to use an SQL tag that can use {variable} indirection when creating a Data Type?
Yes, I have just been working on doing this today actually.
The indirect variable can either be a tag in the UDT you are currently building, or any other tag in your tag provider.
The SQL Query in my UDT searches an SQL table for a matching device name and description and returns a string.
SELECT CONCAT(TagName,' - ', TagDesc) FROM IOList WHERE TagID = {[.]tagID};
Where {[.]tagID} is a tag member of the UDT
I’m having trouble with this same thing. I can reference a parameter in the UDT but not another tag within the UDT.
SELECT step, description, type, jointID, variations FROM inverterworkinstructions
WHERE stationNum = {stationNum}
AND (inverterworkinstructions.variations & 1<<({[~]station/variationInStation}-1)) = 1<<({[~]station/variationInStation}-1)
ORDER BY step
in the above query, the where stationNum works pointing to the stationNum parameter in the UDT, but the bitshift comparison does not work when pointing to the tag variationInStation. The bitshift does work when pointing to the same parameter stationNum. Obviously I only did this to test, since it gives the wrong data, but it does work, now I just need to figure out how to get it to work when pointing to the correct variable for the variationInStation.
ok, after looking at the previous post a bit more closely I discovered the problem. when I use the tag picker button on the side of the editor, it chooses the [~]station/variationInStation tag pointer. I simply edited it to [.]variationInStation and now the query is working.
Its sort of a bug in the software that is formatting the tag incorrectly when choosing with the tag picker.