Display label instead of a value from a previous question

I have confuse that how do i set the value of the number/text repeat as that field of the previous record,

Hi,
If I understood you correctly, you are looking at an option of using response from a previous question to appear as part of the text in the next question.? If that is the case an example would be:
Q1. What is the name of your youngest child?
Q2. What is the age of ${Q1} i.e. your youngest child?

As you have seen in the above example , one can reference a previous question by putting the question in Q{nameofquestiongoeshere}

I hope this answers your question. If not, please provide a detailed explanation of what exactly is your problem so that we address it.

Stephane

1 Like

Thanks Stephanealoo,
I would like to know that: i have question 1 and question 1 is the almost value of many records. When i entry data, the quetion 1 is repeat again that value when i already entry it the previous records. So i dont need to entry it, i pass it, and it is safe time for us.

Hi. It seems to me that it is not possible, but ¿what if we want to re-use not a previously entered value but its label?

Hi @sociedadcivilcuba,

Welcome back to the community! You could do the same as outlined in the image below:

In the survey tab of your xlsform:
Image 1

In the choices tab of your xlsform:
Image 2

Data entry screen as seen in Enketo:

Reference xlsform:
jr choice name.xlsx (11.0 KB)

Have a great day!

4 Likes

Thanks for your prompt answer Kal_Lam.
(I tried an easy way of getting that on kobo, just writing something similar to ${Q1}, without success ;(
Thank you very much!

1 Like

Do you mean you still have the issue or it is now working perfectly

Oh, it is working perfectly! I learnt how to do it (thanks to the sample XLSForm provided by Kay_Lam). Sorry for not letting you know that I solved my problem!

2 Likes

Hi @Kal_Lam,
This example you posted above, there is no space in between the “Mr. A” and “is”. I am facing the same issue, how to resolve this? In the preview, I can see the space but once I deploy the form it removes the space. Please help.

1 Like

Welcome back to the community @eeshatariq! This seems to be a bug. I have created a GitHub issue for the same. You could follow it here:

Thank you! I have noticed, this bug only occurs if the variable label is the first word/phrase in the question. So if I add a fullstop before the the label, the issue does not arise. Thus, it probably should work in this example if it were written as “.Mr. A is Male”

2 Likes

Thank you @eeshatariq for sharing this workaround :clap:! It should be very helpful to users having this issue.

Can someone confirm if they’ve tried this displaying label for autocomplete single select questions? When I put the jr:choice-name accordingly for a calculate question referring to the autocomplete single select question, it cannot extract the label. Because the label and values are stored in a separate media file from which the single select pulls them.