Relevant syntax

When referring to a previous question what is the difference or when would you choose between these two syntax variations

(selected(name, 'choices_answer'))

/data/name = "choices_answer"

selected(${q1}, ‘a’) it's a version we use in xls but selected( /abc/q1 , 'a') is used in xml. If you build your form and use selected(${q1}, ‘a’) after convering to xml it becames selected( /abc/q1 , 'a'). But what interesting in xls you can also use selected( /abc/q1 , 'a') ddirectly and it will be ok but it's less legible of course.

They are identical for select ones but may be different when using a select multiple. In that case, the first expression sees whether a particular choice is in the selected list and the second sees whether exactly that one choice is selected.

1 Like

Thanks both @Grzesiek2010 @LN

The subtle difference between included and exactly would have alluded me.

The question was posed owing to exporting errors showing up from Build to XLSForm. I've got up to speed on XLS edting and now manually corrected these errors. Little bit of extra work but gives a better understanding of Build in the process so not time wasted.

I'll file a bug report shortly pinpointing the issues experienced which in a nutshell involve conversion errors within relevant cells.

2 Likes