Filters
Learn where to add filters.
You can add filters to
- filter data in queries (client and server),
- define the offline data set (server only),
- set initial values for new records ("Template filters"), see Predefined Values for New Records,
- determine whether editing or adding records is allowed ("Rights filter"),
- filters that define which values are applied ("Decision filters"), see Decision Filters.
- editTrigger filters that update the dependent fields when other field values are updated,
While offline data set filters are only executed on the server all other filter types must also be executable on the client.
Sometimes, custom filters defined for some records can prevent the CRM.pad application from synchronizing these records with the CRM.pad server, when these records are linked from other infoareas.
For example, you may have set a filter to prevent the loading of a specific company record. And if the CRM.pad user adds this company to his favourites and then triggers a synchronization with the server. The Favourites infoarea is synchronized with the CRM.pad device, but the Company records are not loaded and the favourites points to an empty record.
Variable Expressions (Filter Tokens)
Filter tokens (variables) are automatically replaced with the current value when the filter is applied. The following filter tokens are replaced by:
-
$curRep:
TherepId
of the current rep -
$curTenant
: The current rep's tenant (not additional tenants!) -
$curOrgGroup
,$curDeputy
,$curSuperior
: The current rep's organizational group, deputy and superior -
$curGeoLongitude
or$curGeoX
: The current longitude coordinate -
$curGeoLatitude
or$curGeoY
: The current latitude coordinate -
$curDay
: The current date -
$curfdWeek
: The date of Monday of the current week -
$curfdMonth
: The first day of the current month -
$curfdQuarter
: The first day of the current quarter -
$curfdYear
: The first day of the current year -
$curTimeSec
: The current time in the formatHHMMSS
-
$curHour:
The current hour -
$cur$$$Y:
The current year -
$????####
: The current day, to be used in birthday queries, see Birthday Filter.
You can add or subtract time periods like +1d, -5d, +2w, -3m, +1y for the following
tokens: $curDay
, $curfdWeek
,
$curfdMonth
, $curfdYear
and
$????####
.
You can use these expressions to hand over values to functions as variables with the
$par
prefix, for example:
-
$parDate:fdWeek
: the first week day of the date in$parDate
-
$parTime:Hour
: the hour of the time in$parTime
You can also add or subtract time periods, for example:
-
$parDate:Day+2d
: two days are added to the date in$parDate
-
$parDate:Hour+2h
: two hours are added to the hour of the date in$parDate
You can use the following expressions to hand over the current geographic coordinates to Template filters (e.g. when you create a new company record on the client's premises, the device's current location is applied):
-
$curGeoX
: the current longitude coordinate -
$curGeoY
: the current latitude coordinate
Using Values from a Rep (ID) Record as Filter Tokens
You can also use values from ID records as filter tokens. For example, the
$parRepCountry
filter token is replaced by the rep's country.
To configure which tokens can be used:
- Create a field group (e.g.
ID.Copy)
and add the fields that you want to use as filter tokens to the List control.Enter the desired function names into the Function field of each field, for example:
Field Function Form of Address RepGender Country RepCountry Region RepRegion - Create a Search&List configuration with the same name as the field group and
select the Field Group (in the example
ID.Copy) and the FilterName (in the
example ID.curRep). If this filter does not exist, the Filter
Token always references the values of the first rep found in the ID table:
- Enter the name of the Search&List configuration in the
RepCopySearchandLists
web configuration parameter, see RepCopySearchAndLists:
You can apply these filter tokens in any query or filter by entering the following
syntax: $par<FunctionName>
.
Using Values from a Record as Filter Tokens
For NewView/EditView
action templates and for the quick add you can
also define values from a specific record as filter tokens.
To define which tokens can be used:
- Switch to the List control in the desired field group and add the fields that you want to use as filter tokens. You can also add records from other info areas that are linked (1:1 or n:1) to the current record.
- Enter the desired token names in the Function field of the desired fields.
- Set the
CopySourceFieldGroupName
input argument of theNewView
and/orEditView
action calls to the previously defined field group, see NewView and EditView. - You can use these filter tokens to copy values from the current record when you open a new page, e. g. in Template filters.
Location Filters
A location filter can be used for searches to return only data that is located within a certain distance from a specific geographic point (Vicinity Search):
- Define the following filter:
- Set the
DistanceFilter.MaxValue
Web Configuration parameter to the desired value, see DistanceFilter.MaxValue.
Destination Filter
With destination filters you can filter destination records belonging to a root record, if these records are not directly linked.
Example from the OTC version:
If a rep issues samples to a person during a business call, the sample records are linked to the KP record, but no link exists to the MA record. Therefore, you can define a filter that you can use e. g. in the quick add to limit the number of records displayed.
Range Filter (From - To)
You can define a range filter with parameters, e. g. for dates.
The user can then define the range to limit the number of records displayed to records within the desired range. You can define range filters for any number fields, date fields, and even text fields.
Example: MA.FromTo
filter contained in the
update.tablet
configuration.
Template Filter
A template filter defines default values that are automatically inserted when a user adds or edits a new record.
Example: FI.ParamLand
filter contained in the
update.tablet
configuration.
Special Parameters for Template Filters used in Record Selectors
If you define a template filter for a record selector, you can also add:
- Parameters using Function names (with the prefix
$par
or$cur
) that have been assigned in the source field group. -
Parameter
:Key
function that is assigned to the new child record. If a user calls the record selector again before saving, CRM.pad does not add another new record but replaces the previous (unsaved) record.
Birthday Filter
If you want to define a filter that returns all birthdays within the next feww days, you cannot define a time period in one criterion but have to add every day as follows:
Delete Warning Filter
The DeleteWarningFilter allows user to use the existing filters for showing delete warning messages.
Based on any custom filter condition user can show custom message while deleting. This
works side by side with delete RightFilter
. If
RightFilter
and DeleteWarningFilter
used together.
First RightFilter
is evaluated then
DeleteWarningFilter
.
When using DeleteWarningFilter
with Delete.Ask
web
configuration. Following are the behaviour:
DeleteWarningFilter | Delete.Ask | Warning Popup | Warning Message |
---|---|---|---|
Match | True | Shown | Message from DeleteWarningFilter |
Not-Match | True | Shown | Generic warning popup message |
Match | False | Shown | Message from DeleteWarningFilter |
Not-Match | False | Not Shown | N/A |
Following is a example usage of DeleteWarningFilter feature, to enable confirmation popup while deleting the main activity in a recurrence series.
Here IsMasterContact field in MA is used for the filter, need to do the following configurations
- In the designer create a filter for MA as below:
select from (MA) where (IsMasterContact='true')
Set the Display Text as the message "This is the main activity in a series of recurring activities. Do you want to delete all activities in the entire series ?" in the filter.
- In the Delete Button need to add the Input Argument DeleteWarningFilter
and set the newly added filter name. Use the modified delete button in the
MA.Expand header
- Make sure to do the Client Data Model update.
- Do a full sync in CRM pad and try to delete a Main Activity. User gets the
configured error message in a confirmation popup.