Filters

You can add filters to Map Drawer commands to limit the records that are shown. For example, a query command with these attributes will show other service requests near a selected request’s location:

Attribute Value
id 4
items 1
querymoniker Hansen.CRM.ServiceRequest
state on
text Open Service Requests
type query

To show only open service requests in this query you can add a filter. This filter will check each request’s IsResolved property, as indicated by the key attribute, and will only show requests if the value of this property is false.

Attribute Value
key IsResolved
type compproperty
value false

Similarly, if you only want to show closed requests, you could set this value to true. The type attribute is set to compproperty, meaning that the filter selects records based on the specified property and value.

You can also add SQL filters, which are based on SQL WHERE statements. For example, this filter will show work orders near a service request location that were added within the past 30 days:

Attribute Value
type sql
value ADDDTTM > DATEADD(day,-30,GETDATE())

The filter type is sql, and the WHERE clause is displayed in the value attribute. The WHERE operator isn’t included.

Filters can also include parameters. This filter will show work orders that were added within a specified date range, with the beginning and ending dates represented by the parameters [PARAM1] and [PARAM2]:

Attribute Value
type sql
value ADDDTTM > '[PARAM1]' AND ADDDTTM <= '[PARAM2]'

Note that the parameter names are enclosed in square brackets. Because the parameter in this case represents a date/time property, it is also enclosed in single quotes.

To define the parameters, add a PARAMS node under the filter. Each individual parameter is defined in a Param node under the PARAMS node, such as PARAM1:

Attribute Value
default 01/01/1999
name PARAM1
source control
value srScheduled.FromDate

The source attribute is set to control, meaning that the source of the parameter value will be the page control specified in the value attribute. In this case the control is srScheduled.FromDate, which specifies the “from” date of a search range. You can find the correct control names in the Content Manager.

If the source attribute is set to firstinitcomp, the value will be taken from the specified property of the main object for the page from which the Map Drawer was opened. For example, to show service requests of the same type when you’re starting a service request, you could add a query command with a compproperty filter that has its key attribute set to RequestType.RequestType and its value attribute set to ‘[PARAM1]':

Attribute Value
key RequestType.RequestType
type compproperty
value '[PARAM1]'

The source attribute of of PARAM1 is set to firstinitcomp, which in this case indicates the ServiceRequest object, and the value attribute is RequestType.RequestType. The Map Drawer will thus only show requests that have the same request type.

Attribute Value
name PARAM1
value RequestType.RequestType
source firstinitcomp