Retrieve the label of a non active language in multilingual form

I have a multilingual form (attached) and I need to retrieve the label of the "markets" field always in English.
I have used a calculation field as below:
jr:choice-name(${MarketName},'${MarketName}')

This works well when the active language of the form is in English. But when I collect the data in another language it doesn't work (as stated in the documentation. Is there a way to retrieve the label of a non-active language?

SMPMS_20190726_0220.xls (57.5 KB) MyCom.csv (284 Bytes)

As far as I know, there isn't a way to access the label of a non-active language using jr:choice-name. What I would do is introduce an additional column in your choices sheet called something like english_name. Then you could duplicate the English label column, preferably with a formula so the two always stay in sync. That will let you write an XPath query to get that English name. It would look something like

instance('marketName')/root/item[name=${MarketName}]/english_name

What this does is filter all the items in the marketName list to get the one with a name that matches the answer to the MarketName question. Then it selects that item's english_name.

3 Likes

Hello @LN
Thank you for your answer. Should I add this in the "calculate" field:

instance('marketName')/root/item[name=${MarketName}]/english_name

Best

1 Like

Hello,
Beside the great solution of LN, you could also make a combined label name EN - AR for the AR choice labels. Also a long if(.., ..., if(..., .., ...) sequence, based on jour market choice list could solve your demand, but with redundancy for maintenance.

1 Like

Thank you. It have worked perfectly!

1 Like