Using select_one or select_multiple with ${} variables in the type column?

Hi there

I have quite a number of varying sets of choices for a certain question. Sure, I could create a separate question for each set (and then concatenate all of them into the actual question), but this would mean a lot of additional questions/lines.

I tried to calculate a variable named ‘choicelist_id’ (containing the list_name) and then use it in the type column: select_one ${choicelist_id}

The error messages are quite vague (and I still hope that something else triggered them), but am I assuming correctly that this isn’t allowed?

I am afraid this approach will not work, as the reference should correspond to an itemset, not to simple string. You can test it by trying select_one “listName”.

Why not use a complete list and choice_filters for the separate lists? Or the separate lists and a (duplicated) complete list?

1 Like

Thanks for the quick reply.

What is an itemset? If I have
select_one ${choice_id}
in the type column and the choice_id was calculated to contain a string like
enrdates3
and the choices tab contains several lines with “enrdates3” as list_name what is wrong about this being a “string”?

Not sure what you mean be using a complete list and choice_filters for each of the lists – I think I am doing this (as described).

This approach will not work, I think.

You could define a complete choice_list in the XlSForm in the choices sheet, combining a copy of the seperated lists and use the complete list here and

  • the separated lists in other questions
  • or filter the complete list (vjoive_filter) to get the parts for the other questions.
1 Like

For all who happen to run into this thread, here is the solution inspired by wroos:

The full set of possible choices (in the choices sheet) received a numbering (1, 2, 3, …) in a column called ‘filter’ (generic name, so that it can be used for different sets of choices [each with the same list_name] without confusing the reader of the xlsform) and the respective questions received entries in the choice_list column based on calculations, some of them quite complex and long – here is a simple example:
if(${date_previousacadyear}=true,filter<=6,filter<=${enrdates_flt})

2 Likes

@york_rff, @wroos, :clap: :heart: :partying_face:

@york_rff, the community would further benefit if you could share an XLSForm for this relevant section! :bowing_man:

1 Like