SFitz
(Shawn)
April 9, 2019, 2:15am
1
I would like to use count-selected() and cond() to implement these instructions however my Xpath isn't the best:
I know that the count-select() function requires 1 argument. But I need it to assign an integer base on the number of items selected. For example,
4 or 5 items = 1
2 or 3 items = 2
1 item = 3
0 items = 5
Is there another option?
Thanks
Hi,
Maybe you can try this :
cond(count-selected(guiding_question)=0, 5, count-selected(guiding_question)=1, 3, count-selected(guiding_question)=2, 2, count-selected(guiding_question)=3, 2, 1)
here some explanations :
https://wiki.commcarehq.org/display/commcarepublic/CommCare+Functions#CommCareFunctions-cond
-Michel
1 Like
SFitz
(Shawn)
April 9, 2019, 8:17pm
3
Thanks Michael, I appreciate the expertise and the link. It worked perfectly.