Hello all,
I'm trying to create 2 dropdowns where the 1st dropdown will show the unique manufacturer brands from this table.
I managed to do it, but the 2nd dropdown is to get the motorcycle models based on the selected manufacturer. The catch is I need to only make a single query. What I did is I created a query rule then saved it to a local variable. On the 1st dropdown, I used union function to get the unique manufacturers from the local variable containing the query. However, I'm having a hard time on the 2nd dropdown.
Discussion posts and replies are publicly visible
Hi Anwille,
can you pls refer the below code.
a!localVariables( local!selectedDepartment, local!selectedTitle, /* * Hardcoded values are stored here through the choose function. Typically * this data would live with the department in a lookup value. In that case * local!selectedDepartment would act as a filter on that query to bring * back titles by department. */ local!availableTitles:choose( if(isnull(local!selectedDepartment), 1, local!selectedDepartment), {"CEO","CFO","COO","Executive Assistant"}, {"Director","Quality Engineer","Manager","Software Engineer"}, {"Accountant","Manager","Director"}, {"Coordinator","Director","Manager"}, {"Consultant","Principal Consultant","Senior Consultant"}, {"Account Executive","Director","Manager"} ), a!sectionLayout( label: "Example: Cascading Dropdowns", contents: { a!dropdownField( label: "Department", choiceLabels: { "Corporate", "Engineering", "Finance", "Human Resources", "Professional Services", "Sales" }, choiceValues: { 1, 2, 3, 4, 5, 6 }, placeholder: "-- Select a Department -- ", value: local!selectedDepartment, saveInto: { local!selectedDepartment, a!save(local!selectedTitle, null) } ), a!dropdownField( label: "Title", choiceLabels: local!availableTitles, choiceValues: local!availableTitles, placeholder: "--- Select a Title ---", value: local!selectedTitle, saveInto: local!selectedTitle, disabled: isnull(local!selectedDepartment) ) } ) )
For what it's worth, this example is from the documentation page for cascading dropdowns. There's some more information on that page on how to implement it as well here: https://docs.appian.com/suite/help/latest/recipe-configure-cascading-dropdowns.html