Checkbox Selection

Hi Everyone,

I have three fields in interface field A, field B and field C. I need to display the field C values only when the field B is checked. The values in fields are being populated using for each loop. Can anyone please help me on this.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    I don't  understand the question properly  you want to  completely hide grid column or just the data part , If it's data then use if  in the "value" param or if it's column use "Show when". I wrote a sample code for hiding data in "fieldC" for your reference 

    a!localVariables(
      local!X: {
        a!map(fieldA: "a", fieldB: "", fieldC: "XYZ"),
        a!map(fieldA: "b", fieldB: "", fieldC: "ABC"),
        a!map(fieldA: "c", fieldB: "", fieldC: "EFG")
      },
      {
        a!gridLayout(
          label: "Editable Grid",
          labelPosition: "ABOVE",
          headerCells: {
            a!gridLayoutHeaderCell(label: "Field A"),
            a!gridLayoutHeaderCell(label: "Field B"),
            a!gridLayoutHeaderCell(label: "Field C")
          },
          columnConfigs: {
            a!gridLayoutColumnConfig(),
            a!gridLayoutColumnConfig(),
            a!gridLayoutColumnConfig()
          },
          rows: {
            a!forEach(
              items: local!X,
              expression: a!gridRowLayout(
                contents: {
                  a!textField(
                    value: fv!item.fieldA,
                    saveInto: fv!item.fieldA,
                    readOnly: true
                  ),
                  a!checkboxField(
                    choiceLabels: {""},
                    choiceValues: {true},
                    value: fv!item.fieldB,
                    saveInto: fv!item.fieldB,
                    
                  ),
                  a!textField(
                    value:if(fv!item.fieldB ,fv!item.fieldC,""),
                    saveInto: fv!item.fieldC,
                    readOnly: true,
                    
                  ),
                  
                }
              )
            )
          },
          selectionSaveInto: {},
          validations: {},
          shadeAlternateRows: true
        )
      }
    )

Reply
  • 0
    Certified Senior Developer

    I don't  understand the question properly  you want to  completely hide grid column or just the data part , If it's data then use if  in the "value" param or if it's column use "Show when". I wrote a sample code for hiding data in "fieldC" for your reference 

    a!localVariables(
      local!X: {
        a!map(fieldA: "a", fieldB: "", fieldC: "XYZ"),
        a!map(fieldA: "b", fieldB: "", fieldC: "ABC"),
        a!map(fieldA: "c", fieldB: "", fieldC: "EFG")
      },
      {
        a!gridLayout(
          label: "Editable Grid",
          labelPosition: "ABOVE",
          headerCells: {
            a!gridLayoutHeaderCell(label: "Field A"),
            a!gridLayoutHeaderCell(label: "Field B"),
            a!gridLayoutHeaderCell(label: "Field C")
          },
          columnConfigs: {
            a!gridLayoutColumnConfig(),
            a!gridLayoutColumnConfig(),
            a!gridLayoutColumnConfig()
          },
          rows: {
            a!forEach(
              items: local!X,
              expression: a!gridRowLayout(
                contents: {
                  a!textField(
                    value: fv!item.fieldA,
                    saveInto: fv!item.fieldA,
                    readOnly: true
                  ),
                  a!checkboxField(
                    choiceLabels: {""},
                    choiceValues: {true},
                    value: fv!item.fieldB,
                    saveInto: fv!item.fieldB,
                    
                  ),
                  a!textField(
                    value:if(fv!item.fieldB ,fv!item.fieldC,""),
                    saveInto: fv!item.fieldC,
                    readOnly: true,
                    
                  ),
                  
                }
              )
            )
          },
          selectionSaveInto: {},
          validations: {},
          shadeAlternateRows: true
        )
      }
    )

Children
No Data