Choices filter - by expression in choices sheet

Hello,
we try to filter a second list by the choices of the first one, using selected(…) expression in then choices sheet.
It seems, as if expression is not working here and just a text interpretation might happen here, like boolean(:'x:). See attached file:
Dynamic Choices - with Expression 02.xlsx|attachment (12.4 KB)
Are we doing something wrong? (@Kal_Lam)

There was another smart solution for the request, see
https://community.kobotoolbox.org/t/how-do-i-use-choice-filters-to-select-what-has-been-selected-in-the-previous-question-along-with-an-additional-none-choice-in-q2/5833/2

Thanks.

Hi @wroos,

Could you share with us your xlsform (with the choice filter question on it) so that we could have a look at if for you.

GOOD DAY!

Dear Kai,
sorry, attached in post had bad link.
Dynamic Choices - with Expression 02.xlsx (12.4 KB)

It seems as anything in ChoiceFilter columns in choices sheet is only treated as string literal (i.e. no functions or ${} reference working).

Best
Wolfgang

Hi @wroos,

You could do the same as shown in the image below:

In the survey tab of the xlsform:

In the choices tab of the xlsform:
Image%202

Reference xlsform:
Dynamic Choices Filter.xlsx (12.5 KB)

1 Like

Dear Kai,
thank you very much.! Yes, this works, we have tried it before the posting, as cited above.
But we did not understand, why our approach doesn’t work. Would be great, if you try to explain it with the our xls (attached before).

My feeling is that the MyChoiceFilter column in the CHOICES sheet is only treated as text literal by KoBo. That means that you NEVER can use there something like ${var} there, neither any function.
Could you confirm this, please? (We did not find a hint on this restriction in the community discussion or in ODK/XLS/XForm manuals so far.)
Kind regards
Wolfgang

1 Like