This page will walk through an example of setting up a form that will display a random yes/no question from a lookup table. This is useful for asking randomized questions for doing knowledge assessment, or to send random behavior change communication out (for example, using CommCare Messaging).
...
First, lets add two select question to the form for each of our random questions.
Next ,we need to add 3 hidden values per random question we want to ask. These are used for selecting a random question, storing the ID of the selected random question and storing the actual question text of the random question. Add the following hidden values as shown below.
Now we'll add calculate conditions to each of the hidden values, starting with those for the planting random question.
...
Next, we will change the label for the the "Planting Random Question" select question to just display the text of the selected question, using an <output value="..." /> statement. Change the label as is shown below.
You can now setup similar calculations and labels for fertilizer calculations and question. You will just need to change the question_category to "fertilizer" instead of planting in any calculations.
...
Testing an application with Lookup Tables
In order to test the conditional select options and other logic works in the application, you must sign on as a mobile user and submit 'real' data to the server.
- Generic User: Create a generic user called "dimagi" or "demo" and update the fixture specifically for this user - populating all the conditional select options with the same 'dimagi' or 'demo'. As long as the partner is aware of the use case, they will be able to filter out this user in reports. During training, mobile users will sign onto CommCare and submit live 'practice' data. Work with the partner to specify a date where all data submitted to CommCare HQ is considered actual data for program purposes. This should be made clear to the FLWs and to the data analyst/M&E officer.
- Training Application: Copy the final application - remove the conditional select options from the application. This app can be used during training as a training application and the users can enter data in demo mode.
- No SIM: If the partner has not secured SIM cards for the phones prior to training, install CommCare on all the phones. Use one SIM card to restore the user or practice user ('dimagi' or 'demo') to all phones. The phone will update according to the latest fixture item list on HQ. Remove the SIM. The conditional select options will work on the phones and the data will not be submitted to the CommCare HQ.