Several Resco tools include a functionality that allows you to define conditions that allow you to filter the records used or displayed in the app. For example:
- In Woodford, when you create a view you can restrict which records are displayed.
- In Sync Filter you decide which records are available in offline mode.
- When using Rules editor in various tools, you can define a variable of the type Entity and use filter to locate the record.
- In Questionnaire Designer, you can select what answers are prefilled if you have answer reuse enabled.
These are the main functions of the filter editor:
- Define conditions, group them with logical operators AND or OR.
- Define the order of the records.
- Restrict the maximum number of records.
- Export or import filters in XML format.
Essentially, filter editor allows users to build database queries or fetches without knowing the syntax of FetchXML.
Each filter starts with an entity. Without additional configuration, it returns all records of that entity. If you specify a custom sort order, it is also displayed, for example:
|contact SORT: lastname, firstname|
Click Add Condition, select one of the entity fields and a condition operator, for example:
Some operators require additional arguments, for example:
Sometimes you need to filter the records of an entity using information from another entity. Click Add Link and select a related entity. Choose the link type as inner or outer join. You can add conditions to this related entity, and also set sort order or restrict the maximum number of returned records. For example, the following view filter shows only those accounts that have an opportunity created within the last 10 days.
|Created On||Last X Days||10|
Additionally, you can decide, how your conditions should be evaluated and grouped:
- AND operator: all grouped conditions must be met
- OR operator: at least one of the grouped conditions must be met
Define sort order and restrict count
Users usually can modify the sort order in the app, but for example in case of a view, it makes sense to define a valid default sort order. You can also define sort order for related entities that you added via Add Link.
- Click Edit Sort to open the Configure Sort Fields window.
- Choose the primary column (for example, Name) and the sort order (for example, Ascending).
- Click Add if you want to another column for sorting. Click Del to remove it.
- Click OK to save your changes.
In some cases, you don't need to find all records, only top five (ordered by a relevant criterion), or even a single one. To restrict the maximum count of records, click Edit Count, enter a value, and then click OK.
Once you're done editing, click Save or Save & Close.
If you want to reuse the filter in another location, click Export XML to download the filter in XML format (FetchXML). Change to the other location, for example to a different app project, and click Import XML to reuse the filter there.
Occasionally, you may run into a situation that you cannot see a particular record in the app. What are some of the possible causes?
- Sync Filters on entities
- Find your entity in the Entities section of your app project and click Sync Filter. If a record does not match your Sync Filter, it is not downloaded to the local database, and therefore unavailable in offline mode.
- Sync Filters on views
- Edit the view and click Edit Filter. If a record does not match your view filter, it is downloaded to the device, but this particular view does not list it. Different views can have different filters.
- Entity Mode (online / offline)
- When you create a record in one mode and then switch to the other mode without synchronizing, that record is not visible in the second mode. Synchronize apps when switching between online and offline modes.
- Max Sync Records for entity reached
- Go to the Configuration section of your app project and switch to the Offline Data Sync tab. The parameter Max Sync Records specifies how many records are downloaded for each object/entity.
- User role (profile)
- Your user role does not have permission to view the record.
|Note||It is not possible to use Parent > Child relationships in Sync Filter (Contact.Account is possible, Account.Contacts is not). The same limitation applies to view filters used in online mode.|
Using search strings in filters
When app users want to filter the records in a view, they can use only the fields of the viewed entity as filter criteria. For example, on the Opportunity view, you can filter records by Customer or Estimated Revenue, because both are fields of the Opportunity entity. However, you cannot filter for opportunities whose customer comes from a particular city, because City is a field of a different entity, Customer.
Fortunately, there's a way. Using the Edit Filter, you can define a set of conditions that allow full-text search in related fields. In the following example, while on the Opportunity view, app users can use the Search function: the string is then compared with the topic of the opportunity, the name of the account or the full name of the owner (with account and owner being related entities). The filter uses the search condition; when at least one field matches the searched string, the opportunity is displayed. This is ensured by the string
@@filter@@ that corresponds to the searched string.
This special behavior is only possible when using the Search function in the app; it does not work for the filter function.