Filter definitions let you filter the data for your report. BUT there are two completely different type of filters, that have a different purpose:
Select filters are filters, that are displayed when generating a report, to select specific objects you want to put on your report.
Select filter types are:
Select filters are shown in the filter selection when generating the report.
For a filter definition you have a lot of options available. Here only the most important options will be explained
Select type of filter you want to use. There are 5 (6 since v. 3.2) different filtertypes:
*since ACD v.3.2 selectperiod filter will receive additional setting "Format of datetime output" which will allow to handle with strings which contain dates in different formats.
Next code will process string with date in format 'YYYYMMDDhhmmss' to the filter:
console.log(start)
console.log(end)
console.log(moment)
const newStart = moment(new Date(start)).format('YYYYMMDDhhmmss')+'Z'
console.log('start', newStart)
const newEnd = moment(new Date(end)).format('YYYYMMDDhhmmss')+'Z'
console.log('end', newEnd)
return [newStart, newEnd]
This filter allow to handle with large number of objects matching Search query. Recommended in case if more than 10 000 entries match base filter Querystring.
Contains 3 fields:
Example: Base Querystring defined in filter is: "objectClass:nrfRequest AND nrfSourceDN:* AND nrfRequester:*". With "re" in "search" field "select" field will be populated with records received from elasticsearch using next query: "objectClass:nrfRequest AND nrfSourceDN:* AND nrfRequester:* AND nrfSourceDN:*re*". Attribute in added query part and '*' placement may be changed using new settings "Filter loaded data dependent on value from" and "How to filter pre-loaded data"
Main feature - this filter makes a new query to Elasticsearch on search instead of searching on results preloaded on filter creation. This also allow to set "Maximum Size of Records to retrieve" less than for selectsearch filter and increases performance.
In ACD v.3.2 select, selectsearch and selectsearchload filters will receive additional element on the bottom of the filter containing information about total amount of records matching filter`s Querystring, Max Limit, number of loaded records and unique records shown in filter (if "Make Unique Values" is checked in settings).
In example we see that filter loaded only 10 000 of 34 292 records available. In such cases recommended to use selectsearchload filter!
Select template to use for displaying the filter. By default we use the same template as the filtertype. If you do not specify a template the filter will not appear!
Define an internal name for the filter. You need this internal filtername if you define dependencies on filters.
This is the filtername as it appears in the filter dialog.
Define the name of the attribute you want to define a filter on. If you do not know the name of the attribute please refer to fields and alias.
Fields and Aliases - SKyPRO Products - Collaboration
Leave it blank for none hidden filters! May contain regexp to filter values. Example: regexp /1|3/ will leave only records where attribute value is either 1 or 3.
Enter a querystring if you want to make a preselection of all attribute values that are available in the filter. e.g. In a user report you only want to select users that are in a subcontainers of ou=users,o=data, you can enter the following query in a filter of the attribute parent:
This querystring will prefilter to show only containers in subtree ou=users,o=data where objects of objectclass inetOrgPerson reside. Therefore this filter will only present the containers shown below. Nevertheless there are some more subcontainers in ou=users,o=data, but these containers do not hold any object of objectclass inetOrgPerson.
Add the same attribute name as in field Attribute to Filter on. (in simple cases)
* contain attribute which value will be set as "Key" of selected option and used as value in resulting report query.
Add the same attribute name as in field Attribute to Filter on.(in simple cases)
* contain attribute which value will be set as "Value" of selected option and displayed to user.
- nrfRequest report is based on objects with objectClass:nrfRequest. This objects have attribures like nrfRequester, nrfTargetDN and nrfApprovalInfo(in custom case of Scwarz Group) which contain a DN of Users. To implement such a report and filter reports using Surname and givenName all three settings Attribute to Filter on, Query keyattribute and Query Valueattribute must contain different values.
In example "Approver 2 Given Name" filter have
Selected value is "Yann" which is a givenName. And on the bottom of the filter displayed selected key -it is User`s DN: "cn=ysommer,ou=users,o=data".
This can be pictured as an HTML select option:
<option value="cn=ysommer,ou=users,o=data">Yann</option>
Accordingly on report creation ACD will send a query containing Must statement with attribute name from Attribute to Filter on {"query_string":{"query": "nrfApprovalInfo: (\"cn=ysommer,ou=users,o=data\")"}}
Check this box in most cases. If there are multiple similar values for the selected value attribute, it only shows the value once.
e.g. If you define a filter on givenName and you have multiple users with the same givenName, the givenName will only appear once.
Make Unique Values checked:
Make Unique Values unchecked:
Check this box in most cases. If there are multiple similar values for the selected key attribute, it only shows the value once.
How do you want to sort the filter values that appear in the filter, asc=ascending, desc=descending
e.g. givenName filter sorted descending.
You can make filters dependend on other filters.
BUT: Only select filters you can make dependent on other select filters! Hidden filters can NOT be used!
e.g. for your user report you only want to be able select users from subcontainers ou=users,o=data. You define a filter on attribute parent as described above in querystring definition. Subsequent filters like lastname (sn) and givenName you want to make dependend on what you select in the parent filter. You only want to show lastnames and givenNames of users in the container you have selected in the parent filter. In that case you have to make the filters on attribute sn and givenName dependent on the filter defined for the attribute parent.
Below you see the filter on attribute parent, named f_parent with the appropriate querystring:
In the filter definition of sn and givenName you add the filter f_parent to make these filters dependend on the f_parent filter
The result is as you click on a specific container in the parent filter the available values in the dependend filters sn and givenName show different values. Only sn and givenName that are available in the selected container.
If you select container ou=IG
If you select container ou=KSSG
If you select container ou=custom
If you select ou=extern
You can even cascade the filter dependencies. So you can make the filter on givenName (Firstname) dependend on what you select on filter sn (Lastname). So if you select a specific lastname only firstnames will be shown of users that have the selected lastname.
To reach this goal make filter givenName (internal filtername e.g. f_givenName) dependend on filter surname (using the internal filtername e.g. f_sn) AND on parent filter (f_parent)
The result will look like this if you select e.g. "Meier" as lastname. There are three users with lastname "Meier": "Stafan Meier", "Max Meier" and "Franz Meier"
Once selected have to contain 'return input;'!
For versions prior ACD v.3.2 input have to be a string.
Since v.3.2 may return an array of objects with properties {key:keyString, value:valueString}
Next file contains some functions which may be used as is or as examples:
Allows to select which attribute to use for filtering of dependent filters.
Available options: Attribute to filter on, Query Keyattribute, Query Valueattribute.
Recipient Surname and Recipient Given Name filters of nrfRequest Report have next settings
Setting Name | Recipient Surname | Recipient Given Name |
---|---|---|
Internam filter name | f_requester_sn | f_requester_gn |
Querystring: | objectClass: inetOrgPerson AND sn:* | objectClass: inetOrgPerson AND givenName:* |
Attribute to Filter on | nrfRequester | nrfRequester |
Query keyattribute | dn | dn |
Query Valueattribute | sn | givenName |
Filter depend on: | - | f_requester_sn |
Filter dependent filter on value from | Query Keyattribute | - |
Report dependent filter on value from | Attribute to filter on | Attribute to filter on |
Filter loaded data dependent on value from | Query Valueattribute | Query Valueattribute |
When "Attribute to filter on", "Query Keyattribute", "Query Valueattribute" have different values like in table above it is important to define which attribute to use for dependent filters and which for resulting report. By default ACD use "Attribute to filter on".
In example when Surname Santos is selected dependent filter uses Query Keyattribute - sn instead of used by default Attribute to Filter on -nrfRequester.
Allows to select which attribute to use
Available options: Attribute to filter on, Query Keyattribute, Query Valueattribute.
!Note: Filter must define Either none or both "Filter dependent filter on value from" and "Report dependent filter on value from" settings.
Allows to select which attribute to use in "search" of selectsearchload filter
Available options: Attribute to filter on, Query Keyattribute, Query Valueattribute.
In table above for both filters this setting is set to "Query Valueattribute". This means what query will search users with sn or givenName matching substring entered in "search" part of filter.
Pattern for pre-loaded data.
Available options (on example ):
Hidden filters do not show up in the filter selection when generating the report. So hidden filters have NO EFFECT on select filters even if you make select filters dependent on hidden filters!
Hidden filters are used mostly if users want to generate a report but do not want to or should not make further filtering. So all filtering for the report is predefined and the report will be generated without further interaction for filtering.
If you nevertheless define select filters on a report that has hidden filter(s), you have to add your hiddenfilter(s) to each select filter in the querystring expression. Otherwise in your select filter(s), values will appear from objects, that will not show up in the report (hidden filters have NO EFFECT on select filters!). This is because the hidden filter(s) are applied after the select filters.