Understand filtering and syntax for web services
- Last UpdatedDec 13, 2022
- 2 minute read
Server-side filtering has slightly different rules to client-side filtering. Although, in most cases the filtering rules apply, there is one main difference. Clients may use localized language and grammar in the construction of filters, but server filtering accepts invariant version only. Also, different rules apply for dates.
Web services filtering
Web services are considered server-side filtering and therefore take the "invariant" version of filtering.
-
Invariant form
-
Uses Field Name instead of Display Name
-
Uses ISO 8601-compliant UTC dates
Note: When selected, string values appear inside double quotation marks, such as "Not Scheduled". These quotation marks are important, as they preserve any spaces included in the string value.
Special date filters
In the client filtering, localized versions of the keywords "Current", "Last", and "Beginning" are supported.
However, in server-side filtering you use the English version of these words only; for example: "Current", "Last", and "Beginning".
AVEVA™ Production Management supports the following filtering for any date-time fields:
-
Current "Period"
-
Last "Period"
-
"Period" Beginning "[Value]"
-
Current "Period" or Last "Period"
Using AND/OR in filter syntax
When you provide a full name of a location or material as part of a web service request and that name has special filter terms within the name (such as AND, OR, NOT), you put single quotation marks around the full name.
For example:
'Enterprise.Site.Stacking and Reclaiming'
Filtering syntax
In most cases, web services filtering is built into the code internally, where filter supports the grammar defined in filtering rules.
Note: Filtering for dates must be UTC and ISO 8601 compliant.
GetDataRequest request = new GetDataRequest();
request.View = new GetDataView();
request.View.Module = AmplaModules.Production;
request.Filter = new DataFilter();
request.Filter.Criteria = new FilterEntry[2];
request.Filter.Criteria[0].Name = "[Field’s Name]";
request.Filter.Criteria[0].Value = "filter";
request.Filter.Criteria[1].Name = "[Field’s Name]";
request.Filter.Criteria[1].Value = "filter";