Issues with a!multipleDropdownField_20r2() in an Editable grid

a!gridLayout(
      emptyGridMessage: "No Claims assigned",      
      headerCells: {
        a!gridLayoutHeaderCell(label: "Dietary Ingredient"),
        a!gridLayoutHeaderCell(label: "Claim"),
        a!gridLayoutHeaderCell(label: "Decision"),
        a!gridLayoutHeaderCell(label: "Category"),
        /*a!gridLayoutHeaderCell(label: "Updated Cat"),*/
        a!gridLayoutHeaderCell(label: "Keywords"),
        a!gridLayoutHeaderCell(label: "Comments"),
        a!gridLayoutHeaderCell(label: "RFI")
      },
      columnConfigs: {
        a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
        a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
        a!gridLayoutColumnConfig(width: "NARROW_PLUS"),
        a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
        /*a!gridLayoutColumnConfig(width: "WIDE"),*/
        a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
        a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
        a!gridLayoutColumnConfig(width: "NARROW")
      },
      rows: {
        a!forEach(
          items: ri!claims_cdt,
          expression: {
            a!localVariables(
              local!category: a!refreshVariable(
              value: index(rule!SFC_getCategoriesByClaimsId( claimId_int: index(fv!item, "claimId_int", "")), "categoryDesc_text", null),                
                refreshOnReferencedVarChange: true
              ),
              local!newCategory_cdt:'type!{urn:com:appian:types:farm}SFC_category'(claimId_int: index(fv!item, "claimId_int", "") ),
              local!totalNewCategory_cdt:'type!{urn:com:appian:types:farm}SFC_category'(claimId_int: index(fv!item, "claimId_int", "") ),

              a!gridRowLayout(
                id: fv!index,
                contents: {
                  a!textField(
                    label: "Dietary Ingredient",
                    value: fv!item.dietaryIngredient_text,
                    readOnly: true
                  ),
                  a!textField(
                    label: "Claim",
                    value: fv!item.claim_text,
                    readOnly: true
                  ),
                  if(
                    ri!readOnly_bool,
                    a!textField(
                      label: "Decision",
                      value: fv!item.reviewDecisionId_int,                  
                      readOnly: true
                    ),

 

                    a!dropdownField_20r2(
                      label: "Decision",
                      placeHolderlabel: "-- Review Decision --",
                      choiceLabels:local!reviewDecisions_cdts.value_text,
                      choiceValues:tointeger(local!reviewDecisions_cdts.lookupId_int),
                      value: if(
                        rule!FARM_isNullOrEmpty(fv!item.reviewDecisionId_int),
                        null,                   
                        fv!item.reviewDecisionId_int
                      ),
                      saveInto: fv!item.reviewDecisionId_int,
                      required: not(
                        rule!FARM_isNullOrEmpty(local!categoriesSelected_texts)
                      ),
                      disabled: false
                    )                
                  ),
                  if(
                    ri!readOnly_bool,
                    a!richTextDisplayField(
                      label: "Category",
                      value: a!richTextBulletedList(
                        items: union(
                          local!categoriesSelected_texts,
                          local!categoriesSelected_texts
                        )
                      )
                    ),
                    a!multipleDropdownField_20r2(
                      label: "Category",
                      labelPosition: "ADJACENT",
                      placeHolder: "-- Select Categories -- ",
                      choiceLabels: local!categoryTypes_cdts.value_text,
                      choiceValues: local!categoryTypes_cdts.value_text,
                      value: local!category,
                      saveInto: {
                        local!category,
                        a!forEach(
                          items: local!category,
                          expression: 
                          {
                            a!save(local!newCategory_cdt.categoryDesc_text,fv!item),
                            a!save(local!newCategory_cdt.isActive_bool, 1),
                            /*a!save(local!totalNewCategory_cdt,union(wherecontains(local!category,local!totalNewCategory_cdt.categoryDesc_text),local!newCategory_cdt)),*/
                            /*a!save(ri!newCategory_cdt,reject(fn!isnull, union(ri!newCategory_cdt,local!totalNewCategory_cdt))),*/

                          }
                        )

                        },                     
                      required: not(
                        rule!FARM_isNullOrEmpty(
                          fv!item.reviewDecisionId_int
                        )
                      )                     
                    )
                  ),
Hello,

I have an editable grid with a multiselect dropdown (Ex: Claims and each row is a separate claim Id). Values in multiselect dropdown are pulled from a separate table (Ex: Category pulled based on Claim ID for each row) 

I'm facing difficulties saving categories to ri! value. When a value is unselected, it isn't getting removed from ri!

Appreciate any help in resolving this issue, TIA. 

  Discussion posts and replies are publicly visible

Parents
  • I can't imagine this is what you actually want the behavior to be, but just to clarify, the code seen here:

    means that if you select multiple items from the list, then each iteration of the forEach() loop iterating over the "local!category" items, the a!save() highlighted will overwrite the "categoryDesc_text" property of the [single] local!newCategory_cdt variable - ultimately just landing on whatever's latest in the local!category list.

Reply
  • I can't imagine this is what you actually want the behavior to be, but just to clarify, the code seen here:

    means that if you select multiple items from the list, then each iteration of the forEach() loop iterating over the "local!category" items, the a!save() highlighted will overwrite the "categoryDesc_text" property of the [single] local!newCategory_cdt variable - ultimately just landing on whatever's latest in the local!category list.

Children