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
Hello Jai_1441 Get the choice labels and choice values in a local. I would not recommend running it directly in the components.Then when you have the code, please do post it here as Stefan has mentioned for a better readability.
Actually am fetching the choice values & choice labels from DB. If I am taking it from local than it worked fine only.
Yes, I meant running your expression rule or the iterations. This helps you understand what's going wrong in the locals.
Yes, I had checked all the rules multiple times and able to fetch correct values from all the rules used in this code.
Is there anything needs to change in value or saveInto parameter?