Version 17.01 is now available, it includes two new features:
- Editing of cascading selects and choice filters in the online editor
- Accessing records from another survey using pulldata
Choice Filters
You can now create and edit choice filters in the online editor. This should be an important feature as even if you develop your form using the excel editor it is fairly common to want to add a few more choices to a cascading select after you have started collecting data. The online editor allows you to do that as you can change the form without affecting the data already collected.
Cascading selects are a type of choice filter where the choices in a select_one question are determined by a selection made in a previous select_one question. Because these are so common the editor provides extra support to simplify their use.
However if you need to do something more complex then you can use the custom filter option which has all the flexibility and power of available when you create choice filters in the excel editor.
The help page has more details. You can also watch the following video which shows creation of both a cascading select and a custom filter.
Looking up data from another survey
Smap offers two functions that can retrieve data from CSV files:
- search() Returns choices for a select
- pulldata() Looks up individual data items using a key
One of the features in Smap that has been there for a while is that you can get the system to automatically generate and update the CSV file from the data in another survey. To do this specify the “file name” as “linked_” then the survey identifier that has the data.
However this was limited when it came to pull data:
- the key could only be a single question in the survey that has the data
- you couldn’t look up repeating data in the other survey, ie where there was more than one record that matched the key.
Both of these issues have now been addressed. For example you may have a survey that has collected data on children registered at a school:
School Class Student Name
school | class | student |
East | A | Fiona |
West | A | Karen |
West | A | Harry |
West | B | Tom |
If we then specify the key to look up this data as: ${school}_${class} and that it is a repeating key then the CSV file that is generated for lookups will look like this:
_data_key | _count | student |
East_A | 1 | |
East_A_1 | Fiona | |
West_A | 2 | |
West_A_1 | Harry | |
West_A_2 | Karen | |
West_B | 1 | |
West_B_1 | Tom |
The _data_key and _count columns are automatically created by the server. The “student” column is there because there is a pulldata() function in the form that gets the answer to the student question. Because there are many students in each class a row is created with a value for _count for each class. Underneath that are rows for each student in the class. The key for these students is the same as the class key with the addition of_1, _2 and so on.
To access this data from a form you can:
- Get the school and class from the user.
- Use these to look up the count for the number of students.
- Then in a repeat group add the value from position() to the school and class to get details for each student.
Details on how to do this are currently being updated in the training material.