Select to view content in your preferred language

Survey123 Report not respecting line breaks

112
2
Wednesday
j-bromp
Frequent Contributor

Hi there,

I have a javascript function in my survey applies a score to a bunch of sentences and then orders the sentences by score. in my function and when viewed in the survey, the sentences are formatted correctly, with line breaks in between each one for example:

Sentence1

Sentence2

Sentence3

All of these sentences are held in a single fieldcalled ${ordered_sentences}. In my report template, when I reference this field however, all the sentences come out as one long paragraph:

Sentence1 Sentence 2 Sentence 3

with no respect to the line breaks.

I have tried using <br> in the function as well as w:br however the latter causes errors when uploading the template and the former just shows <br> in the report.

Any ideas?
Thanks

0 Kudos
2 Replies
Neal-Kittelson
Frequent Contributor

Did you try using the multiline appearance for that field?  Also have you tried \n instead of <br>?  Just some thoughts?

0 Kudos
TylerGraham2
Frequent Contributor

Keep in mind that the report template is a Word document, it isn't going to know what to do with html and likely any other code passed to it through responses.

We have a form with a long narrative section that is setup as multiline question. In the form people can essentially hit enter to start new lines/paragraphs. In the report template it is called with the following syntax ${fieldname | appearance:"multiline"} and it respects how it appears when the user entered data.  

I would set your ${ordered_sentences} appearance in the form to multiline (if it isn't already) and then call it in the report template as ${ordered_sentences | appearance:"multiline"}.