Using filters
Filters can be used in some lists to limit the items returned.
The filter parameter must a JSON formatted object.
Filter types
String
The string filter will search for a value in the field (field contains the value).
The comparison is case-insensitive in any field and also accent-insensitive in descriptions fields.
Examples:
- return all Items/Assets in which the System Code or Description contains 15.01
/api/Items?Filter={System:"15.01"}
Range
The range filter is used for number or date fields. This must be an object with one or more of the following properties:
- "=": the value must be equal
- ">": the value must be above
- "<": the value must be below
If ">" and "<" are specified, then the field value must be within the range.
Examples:
- Get all Materials consumptions in which the Cost is above zero
/api/Records/Materials?Filter={Cost:{">":0}}
- Get all Materials consumptions in which the Id is above 100 and below 200
/api/Records/Materials?Filter={Id:{">":100,"<":200}}
Collection
The collection filter allows to specify an array of values and the field must be equal to at least one of them.
Examples:
- The Item/Asset State must be Active or Maintenance
/api/Items?Filter={State:["Active","Maintenance"]}
Examples
example 1
Get all Purchase Orders where the date is less than 2017-05-23 00:00:00
/api/Purchases?Filter={Date:{"<":"2017-05-23"}}
example 2
Get all Purchase Orders where the date is above 2017-05-23 00:00:00 and the status is prepared or issued, and the manager code contains 08
/api/Purchases?Filter={Date:{">":"2017-05-23"},State:["Prepared","Issued"],Manager:"08"}