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.
[email]
This variable is the one that should be checked for uniqueness.
[existing_email]
This variable will take a value of 1 if the value of [email] exists in another record within the project.
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
@SETVALUE="1"
The [existing_email] field must exist on a form after the form containing [email].
This is required because:
Using a calculation or logic based on [existing_email]:
This allows you to prevent duplicate submissions while keeping the user experience clear and intentional.