Answers.Body: <p>Looks like there's a Craft 2 plugin that exposes PHP's <a href="https://secure.php.net/manual/en/function.array-unique.php" rel="nofollow noreferrer">array_unique</a> method to Twig.</p>
  
  <p>So to continue on the example you linked to, it would be something like this with that plugin installed:</p>
  
  <pre><code>{# Initiate the hash in which we'll store matching submissions. #}
  {% set matchingSubmissions = [] %}
  
  {#
      Loop through all submissions, checking if the specified field
      matches the desired value.
  #}
  {% for submission in submissions if submission.fieldWithValue == '123' %}
  
      {# If the field matches, add it to the hash #}
      {% set matchingSubmissions = matchingSubmissions|merge([submission.fieldWithValue]) %}
  
  {% endfor %}
  
  {# Count the size of the resulting hash and save it. #}
  {% set totalUniques = matchingSubmissions|unique|length %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-22T17:50:16.210Z
Answers.LastActivityDate: 2018-10-22T17:50:16.210Z
Answers.UserDisplayName: Brad Bell
Answers.Body: <p>You could also add <code>andWhere</code> to your query. Look to the table 'freeform_fields' for the field who you want to use for the query end remember the id of the field. In the table 'freeform_submissions' look to the field names an look to field_[rememberd_id]</p>
  
  <p>field__21 is in my case a hidden field for an entryId to show all submissions related to an entry.</p>
  
  <p>for example:</p>
  
  <pre><code>{% set submissions = craft.freeform.submissions({
      form: 'formName',
      status: ["open"],
  }).andWhere('field_21 =' ~ entry.id) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-14T07:38:39.533Z
Answers.LastActivityDate: 2019-05-14T08:40:02.127Z
Answers.LastEditDate: 2019-05-14T08:40:02.127Z
Answers.UserDisplayName: Maarten Heideman
Body: <p>I'm needing to get the unique entry submission amount for a value.</p>
  
  <p><strong>Example:</strong>
  Item1, Item2, Item1, Item3, Item1</p>
  
  <p><strong>Would return:</strong>
  3</p>
  
  <p>I was able to use the workaround here <a href="https://craftcms.stackexchange.com/questions/23277/search-filter-freeform-submissions-by-field-value">Search/Filter Freeform submissions by field value</a> to get the specific submission amount but only wanting to know the number of unique submission values.</p>
  
  <p>Can anyone help?</p>
  
Tags: <plugin-freeform><freeform>
Title: Freeform plugin unique submission amount
ThreadText: # Freeform plugin unique submission amount
  
  (Asked by: username_0 on 2018-10-21)
  
  I'm needing to get the unique entry submission amount for a value.
  
  **Example:**
  Item1, Item2, Item1, Item3, Item1
  
  **Would return:**
  3
  
  I was able to use the workaround here [Search/Filter Freeform submissions by field value](https://craftcms.stackexchange.com/questions/23277/search-filter-freeform-submissions-by-field-value) to get the specific submission amount but only wanting to know the number of unique submission values.
  
  Can anyone help?
  
  **Tags:** plugin-freeform, freeform
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-10-22. Score: 1
  
  Looks like there's a Craft 2 plugin that exposes PHP's [array\_unique](https://secure.php.net/manual/en/function.array-unique.php) method to Twig.
  
  So to continue on the example you linked to, it would be something like this with that plugin installed:
  
  ```
  {# Initiate the hash in which we'll store matching submissions. #}
  {% set matchingSubmissions = [] %}
  
  {#
      Loop through all submissions, checking if the specified field
      matches the desired value.
  #}
  {% for submission in submissions if submission.fieldWithValue == '123' %}
  
      {# If the field matches, add it to the hash #}
      {% set matchingSubmissions = matchingSubmissions|merge([submission.fieldWithValue]) %}
  
  {% endfor %}
  
  {# Count the size of the resulting hash and save it. #}
  {% set totalUniques = matchingSubmissions|unique|length %}
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2019-05-14. Score: 1
  
  You could also add `andWhere` to your query. Look to the table 'freeform\_fields' for the field who you want to use for the query end remember the id of the field. In the table 'freeform\_submissions' look to the field names an look to field\_[rememberd\_id]
  
  field\_\_21 is in my case a hidden field for an entryId to show all submissions related to an entry.
  
  for example:
  
  ```
  {% set submissions = craft.freeform.submissions({
      form: 'formName',
      status: ["open"],
  }).andWhere('field_21 =' ~ entry.id) %}
  
  ```
  
  
  ---
  
  