Skip to main content
August 8, 2024
Solved

Editable Grid

  • August 8, 2024
  • 5 replies
  • 1 view

I am getting  this error "Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!forEach [line 40]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function a!dropdownField [line 65]: A dropdown component [label="roleName1"] has an invalid value for "value". All selected values must be present in the choiceValues array, but value was Role1 and choiceValues was Role1; Role2.".Could anyone please help me to resolve this error

a!localVariables(
local!jurisdictionTask:{
a!map(id:1,taskName:"Task1",taskDescription:"Upload Document1",jurisdictionName:"Arizona",roleName:"Role1",applicationType:"Application Type1" ),
a!map(id:2,taskName:"Task2",taskDescription:"Upload Document2",jurisdictionName:"Arizona",roleName:"Role1",applicationType:"Application Type1"),
a!map(id:3,taskName:"Task3",taskDescription:"Upload Document3",jurisdictionName:"Arizona",roleName:"Role1",applicationType:"Application Type1"),
},

a!headerContentLayout(
contents: {
a!cardLayout(
contents:
a!gridLayout(
label: "Tasks List",
instructions: "",
headerCells: {
a!gridLayoutHeaderCell(label: "Task Name"),/*open text*/
a!gridLayoutHeaderCell(label: "Task Description"),/*open text*/
a!gridLayoutHeaderCell(label: "Jurisdiction"),
a!gridLayoutHeaderCell(label: "Role" ),
a!gridLayoutHeaderCell(label: "Application Type")
},
columnConfigs: {
a!gridLayoutColumnConfig(
width: "DISTRIBUTE"
),
a!gridLayoutColumnConfig(
width: "DISTRIBUTE"
),
a!gridLayoutColumnConfig(
width: "DISTRIBUTE"
),
a!gridLayoutColumnConfig(
width: "DISTRIBUTE"
),
a!gridLayoutColumnConfig(
width: "DISTRIBUTE"
)
},
rows: {
a!forEach(
items:local!jurisdictionTask,
expression:a!gridRowLayout(

contents: {

a!textField(
label:"taskName " & fv!index,
value:fv!item.taskName,
saveInto: fv!item.taskName
),
a!textField(
label:"taskDescription" & fv!index,
value:fv!item.taskDescription,
saveInto: fv!item.taskDescription
),
a!dropdownField(
label:"jurisdictionName" & fv!index,
choiceLabels: {"Arizona","Kansas"},
choiceValues: {"Arizona","Kansas"},
placeholder: "--- Select a jurisdiction ---",
value:fv!item.jurisdictionName,
saveInto:fv!item.jurisdictionName
),
a!dropdownField(
label:"roleName" & fv!index,
choiceLabels: {"Role1","Role2"},
choiceValues: {"Role1","Role2"},
placeholder: "--- Select a role ---",
value:fv!item.roleName,
saveInto: fv!item.roleName
),
a!dropdownField(
label:"applicationType" & fv!index,
choiceLabels: {"Application Type1","Application Type2"},
choiceValues: {"Application Type1","Application Type2"},
placeholder: "--- Select a application type ---",
value:fv!item.applicationType,
saveInto:fv!item.applicationType
)



},
id: fv!index,
)
)



},
selectionSaveInto: {},
addRowLink: a!dynamicLink(
label:"Add New Task",

saveInto: {
a!save(
local!jurisdictionTask, remove(local!jurisdictionTask, save!value)
),
}
),
shadeAlternateRows: true,
rowHeader: 1
))
},
backgroundColor: cons!NAIC_TXT_HEX_LIGHT_GREY,
contentsPadding: "EVEN_MORE"
)
)

    Best answer by stefanhelzle0001

    Your code works for me. Did you try to reload the editor or click TEST? This refreshes any local variables you might have changed.

    5 replies

    stefanhelzle0001
    Brainy
    August 8, 2024

    stefanhelzle0001
    Brainy
    August 8, 2024

    Your code works for me. Did you try to reload the editor or click TEST? This refreshes any local variables you might have changed.

    August 8, 2024

    Hi[mention:a11f77a729fb4db2af76b09948583328:e9ed411860ed4f2ba0265705b8793d05] ,On refresh it was not working for me,I replaced remove by append then it worked for me,But dont know what was happening earlier?

    karumurua531442
    August 8, 2024

    hi [mention:7c701b435ad74d8c83998e400867b512:e9ed411860ed4f2ba0265705b8793d05]  modified code you can try this

    a!localVariables(
      local!jurisdictionTask:{
        a!map(id:1,taskName:"Task1",taskDescription:"Upload Document1",jurisdictionName:"Arizona",roleName:"Role1",applicationType:"Application Type1" ),
        a!map(id:2,taskName:"Task2",taskDescription:"Upload Document2",jurisdictionName:"Arizona",roleName:"Role1",applicationType:"Application Type1"),
        a!map(id:3,taskName:"Task3",taskDescription:"Upload Document3",jurisdictionName:"Arizona",roleName:"Role1",applicationType:"Application Type1"),
      },
    
    
      a!headerContentLayout(
        contents: {
          a!cardLayout(
            contents:
            a!gridLayout(
              label: "Tasks List",
              instructions: "",
              headerCells: {
                a!gridLayoutHeaderCell(label: "Task Name"),/*open text*/
                a!gridLayoutHeaderCell(label: "Task Description"),/*open text*/
                a!gridLayoutHeaderCell(label: "Jurisdiction"),
                a!gridLayoutHeaderCell(label: "Role" ),
                a!gridLayoutHeaderCell(label: "Application Type"),
              
              },
              columnConfigs: {
                a!gridLayoutColumnConfig(
                  width: "DISTRIBUTE"
                ),
                a!gridLayoutColumnConfig(
                  width: "DISTRIBUTE"
                ),
                a!gridLayoutColumnConfig(
                  width: "DISTRIBUTE"
                ),
                a!gridLayoutColumnConfig(
                  width: "DISTRIBUTE"
                ),
                a!gridLayoutColumnConfig(
                  width: "DISTRIBUTE"
                ),
               
              },
              rows: {
                a!forEach(
                  items:local!jurisdictionTask,
                  expression:a!gridRowLayout(
    
                    contents: {
    
                      a!textField(
                        label:"taskName " & fv!index,
                        value:fv!item.taskName,
                        saveInto: fv!item.taskName
                      ),
                      a!textField(
                        label:"taskDescription" & fv!index,
                        value:fv!item.taskDescription,
                        saveInto: fv!item.taskDescription
                      ),
                      a!dropdownField(
                        label:"jurisdictionName" & fv!index,
                        choiceLabels: {"Arizona","Kansas"},
                        choiceValues: {"Arizona","Kansas"},
                        placeholder: "--- Select a jurisdiction ---",
                        value:fv!item.jurisdictionName,
                        saveInto:fv!item.jurisdictionName
                      ),
                      a!dropdownField(
                        label:"roleName" & fv!index,
                        choiceLabels: {"Role1","Role2"},
                        choiceValues: {"Role1","Role2"},
                        placeholder: "--- Select a role ---",
                        value:fv!item.roleName,
                        saveInto: fv!item.roleName
                      ),
                      a!dropdownField(
                        label:"applicationType" & fv!index,
                        choiceLabels: {"Application Type1","Application Type2"},
                        choiceValues: {"Application Type1","Application Type2"},
                        placeholder: "--- Select a application type ---",
                        value:fv!item.applicationType,
                        saveInto:fv!item.applicationType
                      ),
                    
    
    
    
                    },
                    id: fv!index,
                  )
                )
    
    
    
              },
              selectionSaveInto: {},
              addRowLink: a!dynamicLink(
                label:"Add New Task",
                 value: local!jurisdictionTask,
                saveInto: {
                  a!save(local!jurisdictionTask,append(local!jurisdictionTask,null)),
               
                  /*a!save(*/
                    /*local!jurisdictionTask, remove(local!jurisdictionTask, save!value)*/
                  /*),*/
                }
              ),
              shadeAlternateRows: true,
              rowHeader: 1
            ))
        },
        /*backgroundColor: cons!NAIC_TXT_HEX_LIGHT_GREY,*/
        contentsPadding: "EVEN_MORE"
      )
    )

    August 8, 2024

    Thankyou [mention:3510a5189ce1477eaf2e09f5858c87e9:e9ed411860ed4f2ba0265705b8793d05] ,It worked for me