gwp_count_matched_entries
The gwp_count_matched_entries Modifier (or Merge Tag) can be used to count entries from another form, based on a shared value with optional extra filters.
It works in two forms:
- As a modifier on a field merge tag: the field value is the value to match. You can also add it to gwp_entry, gwp_user and gwp_eeid merge tags, like
{gwp_user:user_email:gwp_count_matched_entries form_id=5 match_id=2}. - As a merge tag with a fixed value to match, set with the
valueparameter.
:gwp_count_matched_entries form_id= match_id= filter1= operator1= value1= filter2= operator2= value2=
{gwp_count_matched_entries value= form_id= match_id=}
Options
| Option | Info |
|---|---|
| form_id (required) | ID of the form with the entries you want to count. |
| match_id (required) | Field ID or entry property (like created_by) in that form that must be equal to the value. |
| value (required for the merge tag) | The value to match. A fixed text; merge tags inside it are not replaced. Not used with the modifier, which matches the field value. |
| filter1, operator1, value1 (optional) | Extra filters; add filter2, operator2, value2 and so on for more. All filters must match. valueN supports nested merge tags. |
Supported operators: ‘is’, ‘isnot’, ‘contains’, ‘greater_than’, ‘less_than’, ‘greater_than_or_is’, ‘less_than_or_is’. See Filter and sort matched entries for details.
Only active entries are counted; entries in the trash or marked as spam are skipped. The result is formatted as a number for the site language, so 1234 can show as 1,234. The count does not read field values, so it does not use the Entry access settings of the searched form.
Example modifier
{Textfield:1:gwp_count_matched_entries form_id="2" match_id='1' filter1="3" operator1="isnot" value1=complete filter2="created_by" operator2="is" value2=1}
Matches all entries in Form 2 where Field 1 has the same value as Textfield:1. It counts only entries where the Field 3 value is not ‘complete’ AND where created_by is User 1. The number of matching entries is returned.
Use as a Merge Tag
The same parameters are available as with the modifier. But you must add the value parameter with a match value.
{gwp_count_matched_entries value="match_value" form_id="2" match_id='1' filter1="3" operator1="isnot" value1=complete filter2="created_by" operator2="is" value2=1}
Frequently Asked Questions
Use this modifier to count how many entries in another form match a value from the current form. You must pass that value dynamically through a field merge tag.{Enter Order Code:1:gwp_count_matched_entries form_id="35" match_id="1"}
This counts how many entries in Form 35 have the same value in Field 1 as the user’s input in Field 1 of the current form.
Yes. You can apply one or more filters to limit the count. Use filter1=, operator1=, and value1= to filter results further. In this example, we count only if “Status” (Field 3) equals “Completed”:{Enter Order Code:1:gwp_count_matched_entries form_id="35" match_id="1" filter1="3" operator1="is" value1="Completed"}
Yes — the modifier supports nested merge tags. You can pull the filter value from another field using this syntax: *|Field Label:ID|*. This example uses the user’s selected status as a dynamic filter:{Enter Order Code:1:gwp_count_matched_entries form_id="35" match_id="1" filter1="3" operator1="is" value1="*|Filter Status:5|*"}
Now it only counts entries where both the Order Code and Status match the user’s input.
Only when you use it as a merge tag with a fixed value. As a modifier on a field merge tag, the field value is matched and value=”…” is not used:
Modifier: {Order Code:1:gwp_count_matched_entries form_id="35" match_id="1"}
Merge tag: {gwp_count_matched_entries value="ABC123" form_id="35" match_id="1"}
Yes. It works with dropdowns, radio buttons, text fields, hidden fields, and more. Just make sure the field values match what’s stored in the target form:{Favorite Color:2:gwp_count_matched_entries form_id="27" match_id="9"}
This counts how many entries in Form 27 have the same value in Field 9 as selected in the current form’s Field 2.