Recall previous answers given in prior questions

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
cwells9
Posts: 5
Joined: April 20th, 2013, 11:30 am

Recall previous answers given in prior questions

Post by cwells9 »

Hi,

I am trying to perform something similar to a lookup, but using answers given to previous questions (instead of from an external dictionary). Here's a theoretical example that illustrates what I am trying to do:

Q1a) How many grocery stores are within a 30 min walk of your home?
Q1b) Please list the name of each grocery store (roster)

Q2a) How many pharmacies are within a 30 min walk of your home?
Q2b) Please list the name of each pharmacy (roster)

Q3a) How many parks are within a 30 min walk of your home?
Q3b) Please list the name of each park (roster)

Q4a) Which case would you like to enter info for? (options here would be either):
-1: Grocery Stores
-2: Pharmacies
-3: Parks

Q4b) Which (parks) would you like to enter information about?
The options here would prepopulate based on the response given in Q4a, so for example, if you answered 3 (parks), it would ask you to choose between the parks you listed in Q3b, in a dropdown.

Q5c) (Open text, describing the choice from Q4b)

Thanks in advance for your guidance!
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Recall previous answers given in prior questions

Post by Gregory Martin »

Take a look at the Simple CAPI example that comes with CSPro. If you look at PROC MAIN_LANGUAGE you'll see how a dynamic value set gets created based on the answers to LANGUAGES_SPOKEN and LANGUAGES_SPOKEN_OTHER. You could apply similar logic to create a value set from the answers in Q1B, Q2B, and Q3B.
cwells9
Posts: 5
Joined: April 20th, 2013, 11:30 am

Re: Recall previous answers given in prior questions

Post by cwells9 »

Thanks Gregory, that was a very useful starting place. A couple main differences between my survey and the example there are:
1) The Simple CAPI example includes "Language" as one (select multiple) question where you can input English, Korean etc. as the answer to the same question. For formatting and clarity reasons, it's important that the questions in my survey remain separate.
2) In the Simple CAPI language example, there is a predefined set of values associated with that question. The number of possible combinations is enormous, but there are still 30 or so finite inputs that you can put for that question. In the case of my survey, there is no value set for the ID number. The enumerator will input a specific ID that we have no way of controlling or defining ahead of time.

Based on this, is there anything else you could point me to in order to aid my understanding?

Thanks again.
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Recall previous answers given in prior questions

Post by Gregory Martin »

That example shows how to loop through previously selected options to create a new dynamic value set. Instead of looping through checkboxes, you would loop through each of your rosters (grocery stores, pharmacies, etc.) to create your dynamic value set. Something like:
do numeric ctr = 1 while ctr <= count(GROCERY_STORES)
    // add to value set;
enddo;

do numeric ctr = 1 while ctr <= count(PHARMACIES)
    // add to value set;
enddo;

// ...
Post Reply