How to extract the answers from select_one type questions which are not visible?

Now I am trying to make a questionnaire with the following specifications:

  • Asking respondents which transport to use (A: keep using the mode which the respondent is currently using, or B: a new transport mode) in different conditions of travel time and travel cost compared to the current condition.

  • An example is show below:

  • The combinations of two conditions (reduction of travel time and increment of travel cost) are predetermined in the table below.

To make it in the questionnaire, I used the following techniques:

  • In the first calculate question (rnd_choice_number), I set once(int(2*random())+1) in calculation so that the questionnaire randomly returns 1 or 2 when respondents answer.
  • Based on the generated random number, I set a lookup function using jr:choice-name in select_one sp_rnd which returns 1-3-5-7 or 2-4-6-8
  • In the following calculate type questions (sp_1 to sp_4), I subtracted the first, second and third numbers obtained from select_one sp_rnd
  • Subtracted numbers are used in a series of select_one questions (sp_1_time to sp_4_cost) to extract the actual values from the table above
  • Finally, in calculate type questions (sp_1_time_c to sp_4_cost_c), the extracted values are stored which are used in the actual question table shown above.

Actually, the questions/notes starting from rnd_choice_number to note13 shouldn’t be displayed in the actual questionnaire as these are used only for the preparation/extraction of the values referred in the actual question table (note type questions are used just for a validation to confirm whether the functions are correctly implemented).

Current issue is that once I set a condition in relevant column in some questions (such as sp_3_time, sp_4_time, sp_3_cost and sp_4_cost) using a condition (${rnd_choice_number} = 999) not to display them in the actual questionnaire, the above workflow won’t be implemented properly. I suppose once I hide those select_one questions, the values cannot be referred by other questions.

Do you have any solutions or alternative methods to make it?
Please find the attached XLSForm for your reference.

sp_test.xlsx (17.0 KB)

So your issue is you would like to hide these …

Exactlly yes!
All answers stored in these select_one questions are used only for the table at the bottom of the questionnaire.
Also note-type questions will be deleted as these were inserted just to confirm whether select_one and calculate questions store expected values as I expected.

Thank you wroos. I tried to use disabled option but it seems not to work as expected.
The disabled questions cannot be referred by other questions anymore and bring error messages like this:

I could solve the issue using pulldata() function referring to this thread and tutorial.

https://support.kobotoolbox.org/pull_data_kobotoolbox.html

In this way I could avoid using calculate and select_one chains and directly call the attributes from an external csv file. But I also realized that pulldata() works properly not in preview, but in deployed survey form.

list_sp.csv (162 Bytes) sp_test.xlsx (14.5 KB)

Thank you!!

1 Like

Hello,
I would suggest to also do a test that export of the data is working well with pulldata. And also a test for editing submitted test-cases on the server.
There have been some discussion around this in the forum. @Kal_Lam or @stephanealoo might say more.

Hi,
As far as I know, the system does not have an issue with downloading data when using pulldata functionality. Do you mind pointing out the specific issue that may not have been resolved?

@hideoshiraishi the pull data approach would definately help in your situation.

Stephane

2 Likes

Hello @stephanealoo
Thanks. I scanned the forum and could not find pending KoBo issues with pulldata. So, export and edit (Enketo) should work. (But better test both for the form. before field work.)

2 Likes