XLS equivalent of conditional count in repeat

Dear All,

I was wondering what would be XLS equivalent of following XML:

count(/data/hhMemInfo[Q3c='1'])

Where /data/hhMemInfo is the repeat group?

Thanks!

Hi @Ayub

It allows counting the number of repeat groups. The variable passed is a repeat group name.

Eg; count(${hhmemberrepeat})

May be can you provide more infomation what count(/data/hhMemInfo[Q3c='1'])

is doing, in your context

count(/data/hhMemInfo[Q3c='1']) is making sure to count only when Q3C equals to 1 in the repeat group.

Any ideas to do that for XLS?

Hello @Ayub,
Given the condition it will only count when Q3C=1, it is relevant condition. So it counts only when Q3C=1. I hope it helps

Thanks and Regards,
SGSC

@SGSC

Is there any way to use count() in a similar way in XLS?

Hello @Ayub,

Could you tell me the situation you want to use the count() function . We can use count() function in many cases. For example to count number of options we can use count-selected() function and in many other cases we can use count() function.

Thanks and Regards,
SGSC

@Ayub you can use exactly that statement in your XLSForm. XLSForm makes the ${} syntax available but it doesn't prevent you from using the more explicit XML syntax. That's something I do all the time! Try it and let us know whether that works for you.

1 Like