Table of Contents

Check if response is unique

You can determine whether a response is unique within a project by using an SQL field type and then altering workflow behavior based on the result.

This approach is especially useful for public surveys, such as registration forms, where you may want to prevent multiple submissions using the same email address (or any other unique identifier).

The method works for both instruments and surveys.

Variable Containing the Unique Value

Variable Name

[email]

This variable is the one that should be checked for uniqueness.

Existing-Value Check Variable

Variable Name

[existing_email]

This variable will take a value of 1 if the value of [email] exists in another record within the project.

SQL Logic

select 1, 'exists' from [data-table] 
  where project_id = [project-id] and field_name = 'email' 
    and value = (select value from [data-table] 
               where project_id = [project-id] and field_name = 'email' and record = [record-name]) 
    and record != [record-name]  limit 1

Action Tags

@SETVALUE="1"

What this does

Important Note

The [existing_email] field must exist on a form after the form containing [email].

This is required because:

Result

Using a calculation or logic based on [existing_email]:

This allows you to prevent duplicate submissions while keeping the user experience clear and intentional.