# Checking for Duplicate values in a field

To prevent users from uploading duplicate values for a specific field, you can utilize the [data validation function](https://docs.osmos.io/developer-docs/uploader-client-side-validation/validation-functions).&#x20;

Below is an example of such a function that identifies duplicate values in a column and displays an error message to the user:

```javascript
      {
        name: "email address",
        displayName: "email address",
        description: "Email address of the user",
        validator: async (rows) => {
            let seen = {};
            return rows.map(row => {
                if (seen[row[2]]) {
                    return {
                        errorMessage: 'Duplicate value found. Please check.'
                    };
                }
                seen[row[2]] = true;
                return true;
            });
        }         
      }
```

In this function:

1. We iterate over each element in the `rows` array.
2. For each `row`, we check if the email address at index 2 (`row[2]`) has been seen before. If it has, we add it to the `seen` object.
3. After the loop, if any duplicate email addresses are found (i.e., if the `seen` object contains the email address more than once), we return an error message indicating the duplicate value found.
4. If no duplicate email addresses are found, we return `true` to indicate that the validation passed without any issues.
