Filters

Learn about filters info areas in CRM.client.

You can add filters to

  • filter data in queries (client and server).
  • define the offline data set (server only).

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.Client application from synchronizing these records with the CRM.Client server, when these records are linked from other infoareas. To ensure that such linked records are synchronized with the CRM.Client device inspite of the preventive filters defined, set the Sync.IncludeLinkedData to true. For more information, see Sync Parameters.

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: The repId 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 format HHMMSS
  • $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 (for example, when you create a new company record on the client's premises, the device's current location is applied):

  • $curGeoX: the current latitude coordinate
  • $curGeoY: the current longitude 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:

  1. Create a field group (for example, 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
  2. 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:


  3. 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:

  1. 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.
  2. Enter the desired token names in the Function field of the desired fields.
  3. Set the CopySourceFieldGroupName input argument of the NewView and/or EditView action calls to the previously defined field group, see NewView and EditView.
  4. You can use these filter tokens to copy values from the current record when you open a new page, e. g. in Template filters.

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: