XLSForm $ notation and select questions

Is it just me, or if you use $ notation referring to a select question, you will not get the translated label of the selected option? Just the the untranslated name?

Furthermore, if you have an external select, Am I correct in thinking that it's not possible to pull out the value using $ notation or xpath? I tried it and I just get 'xxx'.

Hi @tomsmyth,

If i get you right, you are using two labels. Thus

  1. English
  2. Other language

Any when you use ${} refer to a question you will not get the label for the selected option in the Other language. You only see the one in English option.

If this is what you meant , then it is possible to pull out the value using ${}.

You have to make sure the following are in place In the xlsform

  1. In the choice sheet make you have two label, one for English (label) and one for other (label:other) language.

  2. In the settings sheet , make sure the default_language is other.
    eg. if your other language is Franch (default_language = Franch)

  3. You have to get a calculation field to look into the label in the choice sheet instead of the name.

calculation explanation.
If you have a variable gender
Male = 1
Female = 2

On your xlsform in the choice sheet you have

  1. Label for English

  2. Label for other language ( lets asume that this is your other language label)
    Male (doo)
    Female (paga)

In your calculation field you wilk have

Type = calculate
name = display_gender
label= gender English
label = gender Franch
Calculation = jr:choice-name(${gender}, '${gender}')

Then when all this are done. you will now refer the gender in your next questions using ${display_gender} instead of ${gender}.

If male is selected using

  1. ${gender} Will give you "1" (name)
  2. ${display_gender} Will give you "Male (doo)" (label for other)

If this is what you are looking for, then this is how it can be done.



Great answer, thank you.

Do you know if there is anyway to get the label of the selected option if it is in an external select?

Please can you explain what you mean by external select, or you are referring to pulling data from csv file. If you are referring to pulling data from csv file how to get the label, then you have to refer to your calculation field and refer to the name in the calculation.

Please let us get a clear picture of what you intend doing.


select_one_external.xlsx (14.1 KB)

See the att'd xls. Is it possible to show the label of the selected city in note bar? If so, how?

Using jr:itext won't work because the cities are not in the itext block -- they are loaded from CSV.

Thank you!

Unfortunately, I am pretty sure the answer is that this is not possible. You might also be tempted to use pulldata but the external itemset and pulldata implementations are completely unrelated and incompatible. This is related to our discussion about interacting with data outside the form from the developer call a couple months back and illustrates why a single approach to external data that is complete will provide value. @dcbriccetti and @michal_dudzinski have been working on this (thanks!).

How many records are you loading, on what devices and how slow is it to use non-external select_ones? One step towards unifying the external data implementations is to improve performance internal select_one performance. If you can provide a sense of the size of your dataset (how many states, how many countries, how many cities) and the performance of the devices you work with, that will provide more information for that work. You can also follow it at https://github.com/opendatakit/javarosa/issues/170

Hi Tom,

I have look at your sample and i release that it is not possible because of the choices sheet, but there is an alternative way you can do it to get the same results. Follow this links to download the forms and have a look at it.

csv file


Thanks but I don't quite understand what you've done there. Could you explain a bit?

Hi, Tom

Do you download those forms, if yes i will explain to you how some of the fields work, if no download them and let me explain them to you., so that you can have your label shown the note field.

Yes I downloaded them, but I don't see any cascading selects. That is the key feature here for me. Cascading selects with very large numbers of options.

a single approach to external data that is complete will provide value.

Can you help me remember what state this is in? Is there any documentation yet? Can it be used for cascading selects? If not, what else needs to happen there?

Interesting. @LN any thoughts here? I haven't dug deep into @Fabla's solution to know if it will work for my case but it seems promising...

But even if it is, would it make more sense for me to wait for external instances since that is the glorious future?

this is how the xlsform looks like for the first four rows

did you see the district enumerator community and hhid all those options are in the csv file. it has to be pull into the xlsform

lets take this step by step to arrive at a nice point of understanding.
you can increase the number of options to be selected in the district, enumerator community and hhid field if you want more option under that, below is how the csv file for the district, enumerator community and hhid would look lik.

this is how the csv file looks like for the first four rows in the xlsform
more hhid,community, enumerator, and districts can be added here

lets look at this if it is okay for you will go to the next step.

alternatively this can be done without the csv file it will still serve your purpose, if you are interested i can share a sample of that with you using the sample form you shared on this platform so that you can see how it works.


The search function is deprecated, please see here for more information.

Cascading selects don't say anything about where the choices are stored -- when you use select_one with a choice_filter, you are using a cascading select with values stored internally to the form.

It's a work in progress. The more feedback and interest there is, the more likely it is to happen quickly. In particular, it would be very helpful if you could verify your data set with internal cascading selects and the devices you intend to use and report back on performance. If you share how many levels of cascading there are and how many choices are in each, we can verify that against performance improvements that will be coming out in the next Collect release. That may be sufficiently performant. Once there is an implementation that is sufficiently performant for tens of thousands of records, documentation will be updated.

1 Like

If you share how many levels of cascading there are and how many choices are in each

Gotcha. I will try to get that done ASAP. Not sure where this ranks in TCC's priority list, so I can't say exactly when.

Thank you both very much!

1 Like