error

Hi all, I am getting error as "Interface Definition: Expression evaluation error at function a!forEach [line 52]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function a!checkboxField [line 88]: A checkbox component [label=“”] has an invalid value for “value”. All selected values must be present in the choiceValues array, but value was 1 and choiceValues was 1."  

even though given same as choiceValues as value,Can Someone suggest me on this?

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Lead Developer
    in reply to JS0001
    if i try to give value smtg

    Can you clarify what you mean by this?  Please post an updated code example and a screenshot of what error message you're getting.

  • 0
    Certified Lead Developer
    in reply to JS0001

    Hi,

    As Mike mentioned your choicelValues configuration is not right. But if you are trying to query something when user selects check box and save that value to that column see that attached sample code which might help you.

    a!localVariables(
      local!yourCDT: {
        a!map( id: 1, checkboxColumn: null , lastName: null ),
        
      },
      a!formLayout(
        label: "Example: Add,Update, or Remove Employee Data",
        contents: {
          a!gridLayout(
            totalCount: count(local!yourCDT),
            headerCells: {
              a!gridLayoutHeaderCell(label: "Check Box" ),
              a!gridLayoutHeaderCell(label: "Last Name" ),
              a!gridLayoutHeaderCell(label: "" )
            },
            columnConfigs: {
              a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
              a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
              a!gridLayoutColumnConfig(width: "ICON")
            },
            rows: a!forEach(
              items: local!yourCDT,
              expression: a!gridRowLayout(
                contents: {
                  a!localVariables(
                    local!checkBoxValue: fv!item.checkboxColumn,
                    a!checkboxField(
                      label: "check box lable " & fv!index,
                      choiceLabels: { "Yes" },
                      choiceValues: { 1 },
                      value: local!checkBoxValue,
                      saveInto: {
                        local!checkBoxValue,
                        /*if you want to query and something from DB and save that value that check box value */
                        /*when user selects check box quet your DB here*/
                        a!save(
                          fv!item.checkboxColumn,
                          /*yor query result*/
                        ),
                        /*or if you want to save your result directly*/
                        fv!item.checkboxColumn
                      },
                      required:true
                    )
                  ),
                  a!textField(
                    label: "last name " & fv!index,
                    value: fv!item.lastName,
                    saveInto: fv!item.lastName,
                    required:true
                  ),
                  a!richTextDisplayField(
                    value: a!richTextIcon(
                      icon: "close",
                      altText: "delete " & fv!index,
                      caption: "Remove " & fv!item.firstName & " " & fv!item.lastName,
                      link: a!dynamicLink(
                        value: fv!index,
                        saveInto: {
                          a!save(local!yourCDT, remove(local!yourCDT, save!value))
                        }
                      ),
                      linkStyle: "STANDALONE",
                      color: "NEGATIVE"
                    )
                  )
                },
                id: fv!index
              )
            ),
            addRowlink: a!dynamicLink(
              label: "Add Row",
              value: {
              },
              saveInto: {
                a!save(local!yourCDT, append(local!yourCDT, save!value))
              }
            ),
            rowHeader: 1
          )
        },
        buttons: a!buttonLayout(
          primaryButtons: a!buttonWidget(
            label: "Submit",
            submit: true
          )
        )
      )
    )

  • This is exactly the same thing which I need to develop, But one issue is in cdt for checkboxcolumn instead of null there is value 0 which was previously inserted. that's why i was getting those error message. Can you help me with these?