I’m storing my form questions in a repeating field within FM.
I’m in a spot where I need the JSON being passed from BF into FM to be converted to an FM list so that the user can also use/edit the form within my FM solution.
Conversely, when the BF form is requested, the FM list needs to be converted back to JSON
My data is being pulled into BF just fine as I’ve set up a model.form.TextQuestionEnglish[x]
array that gets parsed out in my JSON blocks.
Here’s the point where my data from BF is getting set in FM
Set Variable [$responseList ; Value: JSONListValues ($$BF_Model ; "form.textReponse")]
Set Variable [$x ; Value: ValueCount ($responseList) ]
Set Variable [$i ; Value: 0]
Loop
Set Variable [$i ; Value: $i +1]
Exit Loop If [$i > $x]
Set Field [SEL_CaseForm::textResponseEnglish[$i] ; GetValue ($responseList ; $i)
End Loop
In the repetitions where the data is multiple choice, the responses come in as ["ChoiceA", "ChoiceB", "ChoiceC"]
The reps that are single words, the responses simply get set as ChoiceA
.
Anyone have any suggestions on how to convert the JSON to an FM List (¶ separated list)?
Conversely, I need to convert the FM List to JSON on the onFormRequest hook.