Previous Next

You can organize some or all of your questions into distinct groups. You might do this for internal-organization purposes, for more easily managing when whole groups of questions should appear, or for making your form easier to navigate.

In the form designer, click + Add a group, give it a label, and then click Configure to name and configure options for the group.

In the spreadsheet form definition, you can insert rows into your survey worksheet that mark the beginning and end of groups. The row that marks the beginning should have "begin group" in the type column, a short name for the group in the name column (without spaces or punctuation), and a label for the group in the label column. The row that marks the end of the group only requires "end group" in the type column, but most people also include the name in the name column (just for readability).

Some options to keep in mind for any groups that you create:

  1. You can specify a relevance expression to indicate that the group should only be displayed when appropriate (see Implementing skip patterns with "relevance" for more).
  2. You can repeat the questions in a group n times (much more on this below).
  3. You can nest groups (put groups within groups) if you wish.
  4. If you specify "organized" in the appearance column of a "begin group" row, the fields within the group will be visibly organized under the group's label whenever the group's fields are listed. This affects the list of fields that appears when you edit a saved form or use the Go-to Prompt option to jump to another field while filling out a survey form. Group labels will be colored red if any required fields within that group still need to be filled out, otherwise they will be colored green (this coloring of labels always happens in the web interface; on mobile devices, it only happens if the Color form navigation setting is enabled in SurveyCTO Collect). See Designing for easy navigation for more on optimizing your form's navigation.
  5. To display an entire group of questions on a single page, specify "field-list" in the appearance column of a "begin group" row. (You can also combine this appearance option with the above by specifying "organized field-list" in the appearance column.)
  6. If you have a series of select_one or select_multiple fields that share the same option labels, you can put them all into a single "field-list" group and display them all in a compact table. The first select_one or select_multiple field in the series will provide column headers in the top row of the table: simply add "label" to the appearance column of this field. In the select_one or select_multiple fields that follow, add "list-nolabel" to the appearance column so that they appear as additional rows in the table.

For combining questions on a single page, it's often easiest to see (and copy from) a full example: see the sample form in Field lists: Multiple questions on a single screen.

In the spreadsheet form definition:

typenamelabelrelevanceappearance
begin groupgroupnamegroup label  
... fields ...    
end group    
begin groupgroupnamegroup label organized
... fields ...    
end group    
begin groupgroupnamegroup label field-list
... fields ...    
end group    

Repeating questions

To ask a group of questions repeatedly, until the surveyor indicates that he or she is done, use a "repeat group." This works well, for example, for a series of questions about each household member.

In the form designer, click + Add a group, give it a label, and then say "yes" to Repeat the questions in this group?. In the spreadsheet form definition, use "begin repeat" and "end repeat" instead of "begin group" and "end group".

Note, however, that exported data for repeated groups is organized a bit differently because a single submission can have multiple answers to a single question – so it's not as simple as each submission having a single response for a repeated field that can be placed in a single row+column in your exported data. See Understanding the format of exported data for details on the "long" and "wide" formats supported by SurveyCTO.

To repeat a group of questions a fixed number of times based on a prior field value, include ${fieldname} in the repeat_count column (where "fieldname" is the name of a required integer field that contains the number of times to repeat the questions). For example, you might have a field named "num_hh_members" that asks for the number of household members, then have a group of household roster questions with "${num_hh_members}" in the repeat_count column of the "begin group" row. In that case, the survey would ask the household roster questions once for each member of the household.

For a full discussion of your options for repeated questions, see Repeating fields. For working examples, see the Rosters: two methods for repeated questions and Rosters: A third, hybrid method for repeated questions (repeat_count) sample forms.

Finally, to make it easier for users filling out repeat groups to keep track of where they are, review data entered so far, and navigate around, you can put "table" or "table-labeled" in the appearance column of your "begin repeat" rows. If you do, a table will appear underneath each repeated question and will update automatically as users provide their responses. It will allow them to easily review data, and they can click cells in the table to jump elsewhere within the repeat group. The only difference between "table" and "table-labeled" is how rows are labeled: "table" simply numbers rows while "table-labeled" also includes the repeat group's label (which can include ${fieldname} references to include fields from within the repeat group itself). Tip: since the table's header row will include your field names, you should try to name your fields with friendly, descriptive names whenever you use one of these appearances.

In the spreadsheet form definition:

typenamelabelappearancerepeat_count
begin repeatgroupnamegroup label  
... fields ...    
end repeat    
begin repeatgroupnamegroup labeltable 
... fields ...    
end repeat    
begin repeatgroupname${fieldname}table-labeled 
calculatefieldname   
... other fields ...    
end repeat    
begin repeatgroupnamegroup label ${fieldname}
... fields ...    
end repeat    

Previous Next