Automatically add factual information to data table based on previous answer selection

Hi Community,

I would like to create a questionnaire where specific (fixed) information is automatically added in the background - i.e. invisible in the actual questionnaire and without having to select anything - based on the previous select_one selection so that this information will appear in the data table of submitted forms.

A practical scenario:
We have a select_one question with 5 project names. Each project (name) additionally has its own unique ID and according province. In the end, we want both these information to appear in the data table section of submitted forms as individual columns so that we have a complete data set. However, the user completing the questionnaire should not manually fill in/ select these information but they should automatically be added based on the project name selected previously.

We do not want to use the pulldata() function - store all relevant information in a fact table as a csv and get the information from there - as the user filling the questionnaire does not require the information and will oftentimes work remotely without internet access. We just want the information to be “stored in the background of the questionnaire” so that it will appear in the dataset of submitted questionnaires and we have a complete data set.

So is there an option to create additional columns containing information for the defined choices? Or can this be done with a calculation?

Thanks for your help in advance!

I suppose the background variables shall be based on some logic. If we do not need them featuring anywhere in the questionnaire or influencing how we pose form questions, I suggest implying them at analyses level (using the very logic you would use to decide what variable set accompanies what selection pattern in the questionnaire).

In theory that could be done yes. However, ideally all data would be in the dataset right away so that one can view a complete data set in Kobo. To achieve this - at least in my understanding - one one need to include these information “in the background” of the questionnaire so that they automatically get carried into the data set. as individual columns during data gathering and not only in the analysis.

@Infra, I would say you should still be able to pull data even in an environment where there is no internet connection. You will however need an internet service if you wish to update the CSV file (to deploy the form) and get the blank forms to the app or load the freshly deployed form to your browser though.

:slight_smile: This can done with calculations indeed.

An IF statement like this:
if(${Project_Name} = 'A1', 'ID_1', if(${Project_Name} = 'A2', 'ID_2', if(${Project_Name} = 'A3', 'ID_3', if(${Project_Name} = 'A4', 'ID_4', if(${Project_Name} = 'A5', 'ID_5', 0)))))

Here’s the choices sheet: I’ve created 5 different project choices for select_one question:

This is the survey sheet, where you can see select_one question and calculate question which contains the IF formula:

Here’s your screen in ENKETO, users cant see the calculations:

Here’s some submissions where you can see the Project ID column:

Here’s a submission in View mode:

And finally this is the form in xls format:
select_one calculation.xlsx (9.5 KB)

So you can add new calculations for provinces and edit the ID_1, ID_2, ID_3, etc. of the IF statement.
Hope this works.


@hakan_cetinkaya, :clap: :heart: :partying_face:

1 Like

Thank you so much - exactly what I was looking for!