How to return calculation result multilingually?

I would like to switch the label descriptions between Label A (which you used during PSBB) in Case 1 and Label A’ (which you used after MRT opration) in Case 2 based on the answer of Question A (With COVID-19 (During PSBB)) as illustrated below.

This can be implemented using calculate question type where I refer the answer of Question A, with IF(Q1 > 0, “which you used during PSBB”, “which you used after MRT opration”), and refer the returned sentence in Label A as shown below.

However, this method cannot be properly applied if I need to make it in multilingual questionnaire as the calculate question returns the exact characters that I specified in the if() condition.

Do you have any solutions to solve this issue?

I tried another option but failed:

  • Inserting a dummy select_one question which refer the result of calculate question above (but return not the exact sentence, but name 0 and 1)
  • Defining the name 0 and 1 in multiple languages (label:Eng, label:Fr, for instance) in choice sheet

Hi @hideoshiraishi
Have you tried using the jr:choice-name() to show the label instead of value? Kindly look at the following description and this application.

Regards,
Stephane

2 Likes

Thank you for your suggestion.
Yes, I have tried jr:choice-name() in the following way:

  • In a question named freq_calc (Calculate type), set if(${condition} > 0 , “1”, “2”) in calculation field
  • In the next question named dummy (select_one dummy), set dummy in name field (it won’t be shown in the actual questionnaire), set ${freq_calc} in default, and set jr:choice-name(${freq_calc}, ${freq_calc}) in calculation field. In relevant field, I set the contion something like ${freq_calc} = 10000 which never meet the condition not to make this question displayed on the questionnaire.
  • In Choice sheet, set dummy in list_name field, define 1 and 2 in name field and set “during PSBB” and “after MRT operation” in label field respectively so that select_one dummy question can refer it.
  • The dummy question expects to receive the returned value from freq_calc (1 or 2), and these returned value will be converted into label through jr:choice-name() function.
  • Finally, the last question named Result uses the label What is the transportation mode that you used ${dummy}, where ${dummy} will be repladed by “during PSBB” or “after MRT operation”. The label will be changed basd on the answer of ${condition} by a respondent.

However, when I tried to review the questionnaire, it returned JSON purse_error() message and could not open it. My concern is that whether the above method can be accepted by XLSForm as I tried to load calculation result as a default value of the dummy question which need to be converted into label defined in Choice. I hope if I can use more straightforward way.