Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
9 replies
Subscribers
6 subscribers
Views
3121 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Process
In my Tempo tasks (7.4) I am trying to use cascading dropdowns with rules.
saram
over 11 years ago
In my Tempo tasks (7.4) I am trying to use cascading dropdowns with rules.
I tried with this code (inputs:type and failure) but it doesn't work (my rule - getFailureDescription works).
= load(
local!type,
local!failure,
a!formLayout(
firstColumnContents: {
a!dropdownField(
label: "Type",
labelPosition: "ADJACENT",
required: true,
choiceLabels: {
"Tread",
"Wire"
},
choiceValues: {
"Tread",
"Wire"
},
value: ri!type,
saveInto: local!type
),
a!dropdownField(
label: "Failure",
labelPosition: "ADJACENT",
required: true,
choiceLabels: {
rule!getFailureDescription(
local!type
)
},
choiceValues: {
rule!getFailureDescription(
local!type
)
},
value: ri!failure,
saveInto: local!failure
)
...
OriginalPostID-96359
OriginalPostID-96359
Discussion posts and replies are publicly visible
0
saram
over 11 years ago
... }
)
)
Could you help me? Thanks a lot!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jesse.triplett
Appian Employee
over 11 years ago
Have you reviewed the documentation?
forum.appian.com/.../SAIL_Recipes
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
saram
over 11 years ago
Yes, I did. But I don't want "if" condition because data are taken from a DataBase and are many. In my case, values in first dropdown (for example "Fruits" and "vegetables" in the documentation) are distinct values in a column on DB (I just put 2 of them to try the code but it will be a query rule) and second dropdown contains values got by a query rule with in input the value chose in the first one. Thanks again!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jesse.triplett
Appian Employee
over 11 years ago
I think an if statement is still a good way to go.
1)Initialize local!type:"" as a null text.
2)Put an if statement around the second dropdown
if(isnull(local!type),{}, a!dropdown etc...)
This way the second dropdown only appears and executes the query rule when a choice has been made for local!type
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Annelise Dubrovsky
Appian Employee
over 11 years ago
What is the behavior that you are seeing? Your dropdown values are different from your saveInto config. Use the local variable in both and get that working first before switching to rule inputs.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
saram
over 11 years ago
=load(
local!selectedFoodType: tointeger(null),
local!fruitChoice:tointeger(null),
local!vegetableChoice,
a!formLayout(
label: "SAIL Example: Cascading Dropdowns",
firstColumnContents: {
a!dropdownField(
label: "Food Type",
choiceLabels: rule!getTypeExp(),
choiceValues: rule!getTypeExp(),
placeholderLabel: "--- Select Food Type ---",
value: local!selectedFoodType,
saveInto: local!selectedFoodType
),
if(local!selectedFoodType = "",{},
a!dropdownField(
label: "Fruits",
choiceLabels:rule!getFailureDescription(local!selectedFoodType),
choiceValues: rule!getFailureDescription(local!selectedFoodType),
placeholderLabel: "--- Select Fruit Type ---",
value: local!fruitChoice,
saveInto: local!fruitChoice
) )
},
buttons: a!buttonLayout(
primaryButtons: a!buttonWidgetSubmit(label: "Submit")
)
)
)
This is my sale and this is the eroor it returns me:" Expression evaluation error at function a!uiSubmittableForm: A dropdown component [label=“Food Type”] has an invalid value for “choiceValues”. Duplicate items are not allowed in the choiceValues array."
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Annelise Dubrovsky
Appian Employee
over 11 years ago
The error message is indicating that you have duplicates in the array for choiceValues. Can you confirm the result of rule!getTypeExp() and make sure that it doesn't contain any duplicate data? You can do so by going to an expression rule, entering =rule!getTypeExp() as the definition and clicking on "Test Rule".
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
saram
over 11 years ago
Hi, you are right and now it works! My code is the following ("foods" is multiple, "choiceFoodType" and "fruitChoice" are single variables):= a!formLayout( label: "SAIL Example: Cascading Dropdowns", firstColumnContents: { a!dropdownField( label: "Food Type", choiceLabels: ri!foods, choiceValues: ri!foods, placeholderLabel: "--- Select Food Type ---", value: ri!choiceFoodType, saveInto: ri!choiceFoodType ), if( ri!choiceFoodType = "", {}, a!dropdownField( label: "Fruits", choiceLabels: rule!getFailureDescription( ri!choiceFoodType ), choiceValues: rule!getFailureDescription( ri!choiceFoodType ), placeholderLabel: "--- Select Fruit Type ---", value: ri!fruitChoice, saveInto: ri!fruitChoice ) ) }, buttons: a!buttonLayout( primaryButtons: a!buttonWidgetSubmit( label: "Submit" ) ))One strange behavior I notice is the following: I choose in 1st dropdown one value (ex. "Fruits"), in the 2nd I have filtered values (ex."Banana","Orange"). I select "Orange" and then I come back to the 1st dropdown and I change to another value (ex. "Vegetables"). It show a message "The Requested Task Is Not AvailableThe task may have been deleted or completed by another assignee.", but noone has taken the task because I am the only one in my test environment: maybe is it an error in my code? Thanks again!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Annelise Dubrovsky
Appian Employee
over 11 years ago
Answered in other thread:
forum.appian.com/.../e-96788
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel