Filtering in question binding on list

Greetings.

I am trying to filter options after binding to a list question.
I have a question which is supposed to display the list of females 12 to f49,

I tried to bind onto the list question and put a filter like sex==2 && age.InRange(12,49) but no options are displayed.

Iv noted that it works fine when I bind to a question inside the roster, but cannot work when I bind to the list question and try to filter based on questions in the roster having the list question as its source.

Hello @tabo,

This is probably an incorrect description. You should get a compilation error [WB0062]:Option filter expression has a syntax error. Because the program will not be able to understand which value of age and sex it should substitute into the expression.

You need to specify the roster itself as a source in this case to reach the desired behavior.

image

The “Public example User questions and common patterns” questionnaire has more examples of this.

Thanks Sergiy. That was the missing link. I have just set the binding to the roster and it works perfectly. I actually did not know you could bind to the roster itself, I have always known that the choice was between a list question and questions in the roster.
Many thanks for enlightening me.

Sure, glad to help.

For the source you can bind to anything that is suggested in that drop down. It will only show the possible choices.

Thanks for marking the solution!