Relevant conditions do not work in repeat group in XLSForm

Dear All,

During the first repeat index, relevant conditions work fine that are coded as follows:

Few Examples:

relevant = ${hh_age}>12
relevant = ((${hh_gender}='1') and (${hh_mar}='1') and (${hh_have_child}='1'))
relevant= ((${hh_child_outside_age}>12) and (${hh_child_outside_mar}='1'))

However, during second repeat (index) and onward, the conditions don't work at all.

Please guide, since I believe there maybe some syntax that would be different for conditions in repeat.


Hi @Ayub,

Do you use the relevant expressions in the same repeat group where the fields are obtained?
Please provide a sample with both fields (${hh_age} etc.) and relevant expressions utilization. Repeat groups and groups must be represented.

You can try using
Relevance = selected(${field_name1}, '1') and selected(${field_name2}, '1') and selected(${field_name3}, '1')

Try it. If it doesn't work. You can share with us a sample file for us to get the clear picture and see how we can help.


1 Like

Hi @Ayub,

Please try typing in the search field of this forum (the hand lens icon in the upper right) the following words and you will find several posts dealing with relevancy in repeat-groups offering solutions:
relevant, repeat

Good luck.

Actually, in this case using the XPath selected() function instead of an XPath ${foo}='bar' expression wont make a difference. selected() is functionally equivalent to an '=' equality test for everything except when looking up values from a select_multiple. In select_multiple all the chosen values are stored in a single string, separated by a '|' delimiter; selected() scans this string for complete matches (unlike contains() which does a substring match). So if there is only even one value - eg select_one or pretty much any other data type which store a single value - then selected() will return the same result as '='.

Which is to say, Ayub's problem with repeat group relevance tests lies elsewhere...