Convert [group: xxx] to a text value with togroup

I need help. I have a dropdownField where I select three options
but 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 dropdown
I get the values ​​I want (office 2300, office 2450, office 2800) and
not 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

Parents
  • +1
    Certified Senior Developer

    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

  • +1
    Certified Lead Developer
    in reply to vinayr273

    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
    )

Reply
  • +1
    Certified Lead Developer
    in reply to vinayr273

    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
    )

Children