I am trying to use a database binding for my drop down but I am struggling having ingnition choose the 'correct' column as my options. My databases that I am binding it to select statement is:
select rank, concat(loc, ' ', qty)
the problem is that it is only using rank as the value and options. When I switch the order so that rank is after the concat in the select it uses rank as the option and the concat as the value. Ideally I would want the rank to order the dropdown, the concat as the option, and then another attribute as the value.
Is there any way that I can do this and specify which element in the query I to use in the drop down.
I'd recommend adjusting your SQL statement to the following to get your desired outcome:
SELECT concat as label, [other col] as value
SELECT rank, concat(loc,'', qty) as concat, [other col]
ORDER BY rank
select rank as value, concat(loc,'',qty) as label
Thank you so much that worked perfectly!
select [other_column] as value, concat as label
order by rank
a combination of the two was perfect thank you so much!
One last unrelated question but is there a way to add a custom option to the database bind through a perspective method or is best way to just have a script
So I know that it will be help but then add that custom to the binded database permanent would be best done through a script. Just don't want to be overlooking anything that ignition has made that makes this super simple.
There is no built in INSERT functionality for adding to drop down database bindings as far as I know.
You would need a script transform on the binding to add another static option not included from the query like so
options = value.tolist()
thank you so much will try this