I need help. I have a dropdownField where I select three optionsbut they come to me like[group: 67] [group: 68] [group: 69]but these values (office 2300, office 2450, office 2800)I have them in a constant.I'm trying the example below but I can not get it in the dropdownI get the values I want (office 2300, office 2450, office 2800) andnot the ones that come out ([group: 67] [group: 68] [group: 69])
a!dropdownField( label: "OFFICE", placeholderLabel: "Selection", choicelabels: { cons!CP_typeOffice }, choicevalues: { cons!CP_typeOffice }, value: local!filter.type, /*value: togroup(local!filter.type),"description",*/ saveInto: local!filter.type),
thanks
Discussion posts and replies are publicly visible
office 2300, office 2450, office 2800 these are group names ?
Yes and each group has a user.
what value you need to save in local!filter.type ?
Hi,
You need Group Name by GroupId, try below code,
a!dropdownField( label: "OFFICE", placeholderLabel: "Selection", choicelabels: { apply( group(_,"groupName"), tointeger(cons!CP_typeOffice) ) }, choicevalues: { tointeger(cons!CP_typeOffice) }, value: local!filter.type, saveInto: local!filter.type ),
Thanks
Vinay
It worked!
Thanks so much for your answer!!
Just FYI, unless you're using a very old version of Appian (ie pre ~17.2), you should definitely use a!forEach() and not apply(), both for code clarity as well as to ensure you're more future-proof.
a!dropdownField( label: "OFFICE", placeholderLabel: "Selection", choicelabels: { a!forEach( cons!CP_typeOffice, group(fv!item, "groupName") /* you can also wrap fv!item in tointeger() if you're worried but it shouldn't be needed */ ) }, choicevalues: { tointeger(cons!CP_typeOffice) }, value: local!filter.type, saveInto: local!filter.type )
Hi Mike,
I checked both the performance (foreach and apply) for the same logic,
apply is much faster than foreach,
do you think apply function will deprecate after sometime?
thanks for your opinion!!!