Issues with value and saveInto parameter in a!checkboxfield()

Certified Senior Developer

In the code below, I am not able to save the selected values. If i am selecting multiple values for a single question than I am getting below error- 

"Interface Definition: Expression evaluation error at function a!forEach [line 19]: Error in a!forEach() expression during iteration 2: Expression evaluation error at function a!checkboxField [line 27]: Rule 'l' has 1 parameters, but instead passed 2 parameters."

I had highlighted the code where the code needs some correction. NOTE- This code worked perfectly fine for a!RadiobuttonField() but not able to save values while using a!CheckBoxField()

a!localVariables(
local!question: /*calling QE rule to fetch the questions*/
local!option: /*calling QE rule to fetch the options*/
local!numberOfAnswers: 4,
local!correctAnswer: /*calling QE rule to fetch the correct Answer*/
local!selectedAnswer: rule!MWJ_MultiCorrectOption_SelectedAnswer(),  ///// this code is written below.

),

{
a!sectionLayout(
label: "",
contents: {
a!forEach(
items: local!question,
expression: a!localVariables(
local!currentQuestion: fv!index,
{
a!columnsLayout(
columns: {
a!columnLayout(
contents: a!checkboxField(
choiceLabels: {
a!forEach(
items: enumerate(local!numberOfAnswers),
expression: index(
split(stripwith(local!option, "[]ZYWX:"), ","),
if(
local!currentQuestion = 0,
fv!index,
fv!index + local!numberOfAnswers * (local!currentQuestion - 1)
)
)
)
},
choiceValues: {
a!forEach(
items: enumerate(local!numberOfAnswers),
expression: index(
split(local!option, ","),
if(
local!currentQuestion = 0,
fv!item,
fv!index + local!numberOfAnswers * (local!currentQuestion - 1)
)
)
)
},
label: fv!index & ". " & fv!item,
labelPosition: "ABOVE",
value: local!selectedAnswer.SelectedAnswer[local!currentQuestion],
saveInto:
a!save(
local!selectedAnswer.SelectedAnswer[local!currentQuestion],
save!value
),
validations: {}
)
)

},
alignVertical: "TOP"
),

------------------------------------------------------------------------------------

rule!MWJ_MultiCorrectOption_SelectedAnswer(),


a!localVariables(
local!count:count(split(rule!MWJ_multiCorrect_fetchQuestion(),";")),
local!selectedAnswer:
a!forEach(
items:enumerate(local!count),
expression:

a!map(
SelectedAnswer:null,
DummyAnswer:null
)),
local!selectedAnswer,
)

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data