How do I use Autofill in a survey

As a matter of best practice, it is advisable that when using lookups to populate a list in a webform, the Autofill option is used.

This is the problem that can easily arise:

because two independent lists (type-related fields vs. web form-related fields) are being maintained which manually need to be resynchnised each time the list changes.

Autofill is the solution here for multiple choice web form/survey properties.

  • In the Edit Property dialog, under the Type section, you can click the eye icon to cycle through the lookup property types until you get to 'Expression'.
  • Here,  enter any expression which returns an array of values : this can be a lookup(''), a literal ["a","b","c"], csv red,blue,yellow or something references the current dataset e.g. allnodes().department.distinct.
  • Under the Web form section hitting Autofill will populate the select options list for that property with the results of your expression.

As a worked example, I have a list for my 'how did you hear about us' question:

Recommendation
Search engine
Direct mail
Trade conference
Other

Formatted correctly:

['Recommendation','Search engine','Direct mail','Trade conference','Other']

this will be the expression I paste into my property:

Then set the Question type to Select and choose Autofill to complete the options from the lookup:

 

Lookups are static, not dynamic, in Surveys: if you change the lookup, you need to regenerate the lookup values for the web form field. You must use the Autofill button to do this:

 

Have more questions? Submit a request

Comments