I have an expression rule which is containing a data with multiple values, I am trying to insert that data to dropdown choice labels and choice values but I am not able to do that.Can anyone help me to configure that?
Discussion posts and replies are publicly visible
You can simply do that by using the append() function. If it doesn't work, please attach your code for better understanding of what you're doing wrong.
Hi Harshit,
thanks for your reply, getting this error
code:
a!localVariables( local!values:rule!MSAJ_getAllBrands(), local!saveValue,{ a!sectionLayout( contents: { a!dropdownField( label: "Brand", labelPosition: "ABOVE", placeholder: "--- Select a Value ---", choiceLabels:append(local!values), choiceValues: append(local!values), value:local!saveValue, saveInto: local!saveValue, searchDisplay: "AUTO", validations: {} ) } )})
choices values can not be null , append function takes array and values as parameter and you are passing only array into this but this is not the error which is showing on screen, your local!values variable has a null value which should not be.and I think you do not have any use of append function , you can just simply pass the variable and it will be fine until unless you have use for that .
and try replacing line 2 with below piece of code
reject(a!isNullOrEmpty,local!values:rule!MSAJ_getAllBrands()) // this will simply reject null values in an array
Tried, but still getting the same error, even local!values are not having any null values.
Try to flatten the labels and values and also, hit "TEST" afterward. Should work!
tried flatten function, still got the same error, when random choice values are added manually then it is working fine (ramdomly I used enumerate(58) to get 58 values), But when same choice value used in choice values it is not working
do not remove reject function from line 2 , then apply flatten function , then hit 'TEST'