Barbara Malina -

Dynamic Form Linking with Ona

image

Recently, we added the ability for a form or filtered dataset to be specified as a media file for another form. Used in conjunction with the pulldata() function, this lets you dynamically link forms together (i.e pull data from one or more active forms to another form). Dynamic form linking upgrades the pulldata() function so that Ona users aren’t limited to pulling data from static CSV files.

How it Works

Suppose you are collecting data in a survey, such as School Registration, where you are actively collecting the names of all registered students. You want to use that information to conduct another survey, the Student Performance survey, which records how each registered student performs on tests.

The registered student list might change on a weekly basis with students leaving and coming in, so using a static CSV file isn’t sufficient. Linking these forms will ensure you can conduct the Student Performance survey in comfort, knowing you will capture scores for every current student.

Linking the School Registration form to the Student Performance form

Step 1. Navigate to the form’s Settings page, then select Form Media Files. Click on Select dataset to link, on the upper right, to get a list of the forms and filtered datasets that you can link to your form.

image

Step 2. The Link a dataset popup window will apear. Select the project in which the dataset is located and then the name of the dataset to be linked. In the File name field, fill in the name you wish to call the linked dataset. (The file name is used in the pulldata function in Step 4.)

image

Step 3. Click on Link Dataset to save the changes. Your linked dataset will appear on the page.

image

Step 4. Now that the dataset is linked to your form, you can pull data from the linked dataset, School Registration, into your new form, Student Performance, using the pulldata function under the calculation column.

  • Add a calculation field to the form.
  • Give that field a name.
  • In the calculation column, add the pulldata() function.
  • The pull data syntax should have four parameters;
    • The File name of the linked dataset (defined in Step 2),
    • the field name from which data is being pulled from in the linked dataset,
    • the key field to lookup,
    • the last parameter is an identifier can either be a value, text or reference to a previous question to link to the specific row in the lookup field.

The file name of the linked dataset entered above will be the file name referenced in the pulldata() function (i.e. School_Registration).

image

Below is a description of the above syntax - pulldata(‘School_Registration’,’studentname’.’id’,${id})

  • School_Registration is the file name of the linked dataset.
  • studentname is the column in the linked dataset where the data will be pulled from.
  • Id is the key field to lookup.
  • ${id} is the link to the row in the lookup field.

To learn more about linking datasets, visit How do I link a dataset as a media file to another form? on the help site.