I'm sure this is all noob stuff, but I'm trying to make a dropdown dependent on the selection of another dropdown. The first dropdown is populated from a SQL query and filters the table data, I'd like to get the second dropdown to further filter the data but I can't get it to work.
You might get the best help with some more information, screenshots, code snippets, queries, etc.
Use preformatted text button to enter code.
Welcome to the forum.
The second dropdown would itself have its options bound against a parameterized Named Query, where the parameter is supplied as the value of the first Dropdown.
I use something like this for some of our testing pages:
Dropdown 1 Named Query binding for options
:
Named Query SQL: select id as value, type as label from component_types
This returns something like [{"value": "1", "label": "input"}, {"value": "2", "label": "display"}]
, and allows my options to immediately be populated with the expected keys present. I also always change the return format of the binding to JSON, but that's just preference for easier examination of the returned results.
Dropdown 2 Named Query binding on options
:
select component from components where components.typeId=:typeId
Then my binding dialog allows me to specify the parameter value, and I select the value
of Dropdown 1.
Sorry, I actually figured it out. Typical bozo move. I had to set the value of the variable in the query to the prop>value of the first dropdown.
SELECT
DISTINCT Attribute1, Attribute2,
CONCAT(Attribute1,'-',Attribute2) AS CombAttrib
FROM Inventory
WHERE "Location" = :LOC
then the LOC value needed set to:
{../Dropdown.props.value}
So... exactly what I said to do?
Maybe, possibly, probably, yes, thank you!
I apologize, I honestly got lost in your reply because I'm not familiar enough with Ignition.
Best regards,
--H