Hi. I have a dropdown list. It fails when I select one of the values. Here is the code:
a!localVariables( local!formAnswer: { function: "", subFunction: "" }, local!dynameiceValue: { functionList: rule!JRA_QRY_getBusinessOwnerFunctionList_AbbVie(), subFunction: rule!JRA_QRY_getbusinessOwnerSubFunctionList_AbbVie( businessOwnerFunction: local!formAnswer["function"] ), }, { a!dropdownField( label: "function", value: local!formAnswer["function"], placeholder: "select", choiceLabels: local!dynameiceValue["functionList"], choiceValues: local!dynameiceValue["functionList"], saveInto: a!save(local!formAnswer["function"], tostring(save!value)) ) } )
I get the options by query rule and put it into a variable. It looks like good. But it will throw the error when I select the value.
This is the error message:
Interface Definition: Expression evaluation error at function a!dropdownField [line 23]: A dropdown component [label="function"] has an invalid value for "value". All selected values must be present in the choiceValues array, but value was Affiliate and choiceValues was Affiliate; Allergan Aesthetics (AA) Commercial; Commercial; Corporate; Research & Development.
The value "Affiliate" is in the choiceValues. So I do not understand why it fails
Discussion posts and replies are publicly visible
The value must match in data type as well. I see a tostring() in your saveInto. Did you try to use a touniformstring to turn the choiceValues into a list of strings?
I tried it. But it didn't work.
Try using the tostring() in value once. And when providing the choiceLabels and choiceValues, flatten the array once and then wrap the choiceValues in touniformstring() if it is a string or to any other datatype.
The problem is that you create your local data using "{}". Appian looses the data type when accessing the fields. In your situation I recommend to create the dictionaries using the a!map() function and/or apply tostring() on the value and touniformstring() on choicevalues.
Thanks so much! It works after I used a!map
can you show the code how it worked