I created an multiple choice question (max three choices), which is ranked with the rank widget. Now, I would like to enter a value (by using the decimal question type 3 times) for each ranked value with in the label a reference to the ranked value. If you want to refer in the label to a stored value, the ${Value} is needed. However if I use the value where the ranked selected multiple choices is stored, all the choices are visible, while I only want to show the first, second or third ranked choice. Is that possible?
However, I do have a another question related to this question.
Now, I am able to select based on index the stored ranked answers. However, when I refer to the calculate variable in the label below with ${Variable}, then it shows the stored ‘name’ ranked value, while I would like to show the name that is written in the ‘label’. I tried to use for example jr:choice-name(selected-at(${rankCoarse},0),'${rankCoarse}') to solve this, but it gives "undefined’ instead the value stored in the ‘label’ section when validating this form:
See the form Trial_errors.xlsx (14.6 KB). Can anyone help me to fix this problem?
It seems as you need to reference the initial choice_list (instead of the rank) to get the label:
jr:choice-name(selected-at(${rankCoarse},0),‘${coarseSize}’)
and so on.
This referencing is similar to a previous example (see link above): Show selected options as selected - #7 by wroos.
But even jr:choice-name(‘aRankedChoiceName.’, ‘${rankQuestion}’) will show “undefined”.
(As I tested, it is the same without a choice_filter.)
And in table view and Excel export, it seems that you cannot get the labels for a rank!
This is strange for me. It might be a bug? Maybe someone of the core team can explain: @Kal_Lam, @Josh ?
Hi @wroos, thank you for expanding. Here’s an issue for the table view. The jr:choice-name() issue will perhaps be in in Enketo or pyxform, maybe Collect too but I haven’t tested it.
Thanks for the feedback! And I unexpectedly appear to find a bug.
I have a question about jr:choice-name(‘*aRankedChoiceName*.’, ‘${rankQuestion}’. The ‘aRankedChoiceName’ returns the selected choice name answer from the user and ‘rankQuestion’ refers to the question itself and pulls the label of the selected choice name from the referred question?
Hello @Webex,
Side-note: You use special characters in some choices/question names, e.g. -, > and names not beginning with a character. This might create problems for data usage and analysis in other tools, like SPSS.
Thanks for thinking along how work around this bug of ranking! The first option would also be my first choice. In this request for assistance, First rank and then select from ranking - #7 by Josh, is mentioned that KoboCollect may not have this bug. I will test that first. Maybe I won’t have to implement this second option, I will let you know!