User Guide
22 Chapter 2: Working with Filters
Filter examples
The following is a simple example to help illustrate the general concept of filters. The web service
API
report-my-courses returns the list of courses you are enrolled in. This same API used with
a filter on the course name, for example
report-my-courses&filter-like-name=Java,
retrieves your courses with the specified text in the name, in this case “Java”. If you add a sort
filter such as
report-my-course&filter-like-name=Java&sort-date-begin=desc, Breeze
sorts your Java courses and displays the course you started first.
In these examples, there are two types of filters: filter and sort. The basic filter uses the
like
modifier on the
name field with a value Java. If you omit the like modifier, Breeze would return
courses with the exact name Java instead of courses with Java in the name. Using the sort filter
without a modifier on the
date-begin field with a value desc specifies a descending order.
The following table lists a few more examples that are helpful for understanding filter basics:
About date formatting
In Breeze, dates are a special type of field value that follow the ISO 8601 format. For example,
May 28, 2004 is expressed as
2004-05-28 and 4:23pm on May 28, 2004 is expressed 2004-05-
28T16:23:00.000
. Starting with the year, you may use as much of the date as you need to filter
the best result. Using a value of
2004 returns all items that match the same year, which is probably
not a good use of filters. You can retrieve everything that happened in a month by specifying the
year and month. You add as much of the date as you need to select the most accurate data from
the server.
Filter Description
filter-name=Goals Review Returns items from the server that have the specific
name “Goals Review.” This may apply to meetings,
courses, or any items with a name field.
filter-like-name=Goals Returns all items with “Goals” in the name such as
“Goals Review” or “Quarterly Goals.”
filter-out-name=Status Filters out or excludes any items with the word “Status”
in the name field.
filter-like-name=Goals &filter-
out-status=active
Returns all items with “Goals” in the name that are no
longer active; for example, to find previous
presentations on “Goals” from previous quarters.
filter-gt-date-begin=2004-05-
01&sort-name=asc
Returns all items with a begin date later than
May 1, 2004, sorted by name in ascending order.
filter-gt-date-begin=2004-05-
01&filter-lt-date-begin=2004-05-31
Returns all items started in the month of May, 2004.