This article provides a few tips for filtering based on the fields within a specific form.  It is important to note that when filtering for responses to fields in your form, the field name is used. For example, a field name is “Household_contents”. When filtering based on responses to this field, you will use the filter Household_contents. You can configure field response filters by clicking on 'Add additional filters'.


Tips for filtering on the following field types:



Choice fields

Filtering for responses to choice fields are based on the option value, not the text.


Example: 

If you have a 'Select One' field named “Chronic_conditions” with the options  “1. Yes [Y]” and “2. No [N]”, and you want to see all the submissions containing chronic conditions. You would use the following filter: Chronic_conditions: Y


Example

You have a 'Select Many' field named “Household_characteristics” with option values 1 to 4. To filter for all the submissions where options “1” and “3” were selected for this field, you would use the following filter: Household_characteristics:1 AND Household_characteristics: 3



DateTime fields

Filtering for responses to DateTime fields. The following format should be used when filtering on DateTime fields YYYY-MM-DDT00:00:00Z


Example: 

You have a field named "DOB" capturing date of birth. To retrieve all submissions where the date of birth reported was between 9 June 2010 and the current date, you would use the filter: DOB: [2010-06-09 TO now]




The basic syntax supports addition, subtraction and rounding at various levels. Commands can be chained together and are evaluated from left to right. '+' and '-' denote addition and subtraction, while '/' denotes "round". Round requires only a unit, while addition and subtraction require an integer value and a unit. Command strings must not include any spaces.

Modifier
Result
/h
Round to the start of the current hour 
/d
Round to the start of the current day 
+2y
Exactly two years in the future from now
-25m
Exactly 25 minutes ago 
-1d
Exactly 1 day ago 
/d+6M+3d 
6 months and 3 days in the future from the start of the current day
+6M+3d/d
6 months and 3 days in the future from now, rounded down to nearest day 



Number fields

Filter for a numeric integer or decimal field type.


Example

You have a field named "Household_Member_Count". To display all submissions where households had 4 or more members, you would use the filter: Household_Member_Count: [4 TO *]


Example

You have a field named "Baby_Birth_Weight". To filter for all submissions reporting birth weights under 2.5kg, you would use the filter: Baby_Birth_Weight: [0 TO 2.5]


Text fields

To reference a text field type, you can simply use the field name.

Example: 

You have a field named "Job_Other". To view all submissions where the job description entered was "Dentist", you would use the filter: Job_Other: “Dentist”


You can also make use of "wildcards" to filter for partial matches. To perform a single character wildcard match, use the "?" character. To perform a multiple character wildcard match, use the "*" character. Do not enclose the search term in quotations.

Examples:
The filter Job_Other: Art* will return results containing both “Artist” and “Artisan”
The filter Job_Other: T?ster will return results containing both “Tester” and “Taster”

The filter Job_Other:* will return results containing any response to the field

The filter -Job_Other:* will return results that contain no response to the field