Logic

i have condition, where 2 questions are dependent on each other

when i select 1st Q as YES then next Q auto select to NO

if 1st select as NO then no action of 2nd Q

if second Q is YES then 1st to be auto select to NO

if second Q is NO then no action for 1st Q

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Senior Developer

    a!localVariables(
      local!q1,
      local!q2,
      {
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents: {
              a!dropdownField(
                choiceLabels: {"Yes","No"},
                choiceValues: {"Yes","No"},
                label: "Question 1",
                labelPosition: "ABOVE",
                placeholder: "--- Select a Value ---",
                value: local!q1,
                saveInto: {
                  local!q1,
                  if(
                    local!q1="Yes",
                    a!save(
                      local!q2,
                      "No"
                    ),
                    {}
                  )
                },
                searchDisplay: "AUTO",
                validations: {}
              )
            }
          ),
          a!columnLayout(
            contents: {
              a!dropdownField(
                choiceLabels: {"Yes","No"},
                choiceValues: {"Yes","No"},
                label: "Question 1",
                labelPosition: "ABOVE",
                placeholder: "--- Select a Value ---",
               value: local!q2,
                saveInto: {
                  local!q2,
                  if(
                    local!q2="Yes",
                    a!save(
                      local!q1,
                      "No"
                    ),
                    {}
                  )
                },
                searchDisplay: "AUTO",
                validations: {}
              )
            }
          ),
          a!columnLayout(
            contents: {}
          )
        }
      )
    }
    )


    Hi  ,

    try the above code and see if it works for you

Reply
  • +1
    Certified Senior Developer

    a!localVariables(
      local!q1,
      local!q2,
      {
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents: {
              a!dropdownField(
                choiceLabels: {"Yes","No"},
                choiceValues: {"Yes","No"},
                label: "Question 1",
                labelPosition: "ABOVE",
                placeholder: "--- Select a Value ---",
                value: local!q1,
                saveInto: {
                  local!q1,
                  if(
                    local!q1="Yes",
                    a!save(
                      local!q2,
                      "No"
                    ),
                    {}
                  )
                },
                searchDisplay: "AUTO",
                validations: {}
              )
            }
          ),
          a!columnLayout(
            contents: {
              a!dropdownField(
                choiceLabels: {"Yes","No"},
                choiceValues: {"Yes","No"},
                label: "Question 1",
                labelPosition: "ABOVE",
                placeholder: "--- Select a Value ---",
               value: local!q2,
                saveInto: {
                  local!q2,
                  if(
                    local!q2="Yes",
                    a!save(
                      local!q1,
                      "No"
                    ),
                    {}
                  )
                },
                searchDisplay: "AUTO",
                validations: {}
              )
            }
          ),
          a!columnLayout(
            contents: {}
          )
        }
      )
    }
    )


    Hi  ,

    try the above code and see if it works for you

Children
No Data