About Radio Button and Check box

Now I am typing correct answer but i want like I want to select answer if one answer then it must come in radio button to  select the correct answer and if multiple answer means check box must to select multiple answer and in data all questions are mixed with single answers questions and multiple answers questions. so how to give radio button and check box

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Just like Harshit suggested you need check for the Choices, I wrote a simple expression use it as reference for your implementation

    a!localVariables(
      local!questionsWithAnswers:{
        a!map(
          Question:"Where is TajMahal Located",
          Options:{"Agra","Pune","Vizag","Delhi"},
          Answer:{"Agra"}
        ),
        a!map(
          Question:"Cities in India",
          Options:{"NY","Paris","Vizag","Delhi"},
          Answer:{"Vizag","Delhi"}
        )
      },
      local!selectedAnswers,
      a!forEach(
        items: local!questionsWithAnswers,
        expression: {a!richTextDisplayField(
          value: concat(fv!index,".",fv!item.Question),
        ),
          if(
         count( fv!item.Answer)=1,
         a!radioButtonField(
           choiceLabels: fv!item.Options,
           choiceValues: fv!item.Options,
         ),
         a!checkboxField(
           choiceLabels: fv!item.Options,
           choiceValues: fv!item.Options
         )
         
        )}
      )
    )

  • If the values we are taking from cdt not from record then

Reply Children