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 Reply Children
  • But what I'm asking is, what are you doing with "local!totalNewCategory_cdt"?  To clarify what I mean:

    1. what are you hoping the local variable will look like / contain when, for example, 2 or 3 items are selected from the dropdown list?
    2. what happens to this local variable after that?  in your code snippet it's not ever being used for anything
    3. considering that you'll have a list of these local variables for each row in the grid, how exactly will each row's individual list of items be associated with that grid row?