Codeunit "Filter Tokens"
Exposes functionality that allow users to specify pre-defined filter tokens that get converted to the correct values for various data types when filtering records.
Properties
| Name | Value |
|---|---|
| Access | Public |
| SingleInstance | True |
| InherentEntitlements | X |
| InherentPermissions | X |
Methods
MakeDateFilter
Turns text that represents date formats into a valid date filter expression with respect to filter tokens and date formulas. Call this function from onValidate trigger of page field that should behave similar to system filters.
The text from which the date filter should be extracted passed as VAR. For example: "YESTERDAY", or " 01-01-2012 ".procedure MakeDateFilter(var DateFilterText: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| DateFilterText | Text |
MakeTimeFilter
Turns text that represents a time into a valid time filter with respect to filter tokens. Call this function from onValidate trigger of page field that should behave similar to system filters.
procedure MakeTimeFilter(var TimeFilterText: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| TimeFilterText | Text |
The text from which the time filter should be extracted, passed as VAR. For example: "NOW". |
MakeTextFilter
Turns text into a valid text filter with respect to filter tokens. Call this function from onValidate trigger of page field that should behave similar to system filters.
procedure MakeTextFilter(var TextFilter: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| TextFilter | Text |
The expression from which the text filter should be extracted, passed as VAR. For example: "ME". |
MakeDateTimeFilter
Turns text that represents a DateTime into a valid date and time filter with respect to filter tokens. Call this function from onValidate trigger of page field that should behave similar to system filters.
procedure MakeDateTimeFilter(var DateTimeFilterText: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| DateTimeFilterText | Text |
The text from which the date and time should be extracted, passed as VAR. For example: "NOW" or "01-01-2012 11:11:11..NOW". |
Events
OnResolveDateFilterToken
Use this event if you want to add support for additional tokens that user will be able to use when working with date filters, for example "Christmas" or "StoneAge". Ensure that in your subscriber you check that what user entered contains your keyword, then return proper date range for your filter token.
[IntegrationEvent(False,False)]
internal procedure OnResolveDateFilterToken(DateToken: Text, var FromDate: Date, var ToDate: Date, var Handled: Boolean)
Parameters
| Name | Type | Description |
|---|---|---|
| DateToken | Text |
The date token to resolve, for example: "Summer". |
| FromDate | Date |
The start date to resolve from DateToken that the filter will use, for example: "01/06/2019". Passed by reference by using VAR keywords. |
| ToDate | Date |
The end date to resolve from DateToken that the filter will use, for example: "31/08/2019". Passed by reference by using VAR keywords. |
| Handled | Boolean |
Stores whether the operation was successful. |
OnResolveTextFilterToken
Use this event if you want to add support for additional filter tokens that user will be able to use when working with text or code filters, for example "MyFilter". Ensure that in your subscriber you check that what user entered contains your token, then return properly formatted text for your filter token.
[IntegrationEvent(False,False)]
internal procedure OnResolveTextFilterToken(TextToken: Text, var TextFilter: Text, var Handled: Boolean)
Parameters
| Name | Type | Description |
|---|---|---|
| TextToken | Text |
The text token to resolve. |
| TextFilter | Text |
The text to translate into a properly formatted text filter. |
| Handled | Boolean |
Stores whether the operation was successful. |
OnResolveTimeFilterToken
Use this event if you want to add support for additional filter tokens that user will be able to use when working with time filters, for example "Lunch". Ensure that in your subscriber you check that what user entered contains your token, then return properly formatted time for your filter token.
[IntegrationEvent(False,False)]
internal procedure OnResolveTimeFilterToken(TimeToken: Text, var TimeFilter: Time, var Handled: Boolean)
Parameters
| Name | Type | Description |
|---|---|---|
| TimeToken | Text |
The time token to resolve, for example: "Lunch". |
| TimeFilter | Time |
The text to translate into a properly formatted time filter, for example: "12:00:00". |
| Handled | Boolean |
Stores whether the operation was successful. |
OnResolveDateTokenFromDateTimeFilter
Use this event if you want to add support for additional filter tokens that user will be able to use as date in DateTime filters. Parses and translates a date token into a date filter.
[IntegrationEvent(False,False)]
internal procedure OnResolveDateTokenFromDateTimeFilter(DateToken: Text, var DateFilter: Date, var Handled: Boolean)
Parameters
| Name | Type | Description |
|---|---|---|
| DateToken | Text |
The date token to resolve, for example: "Christmas". |
| DateFilter | Date |
The text to translate into a properly formatted date filter, for example: "25/12/2019". |
| Handled | Boolean |
Stores whether the operation was successful. |
OnResolveTimeTokenFromDateTimeFilter
Use this event if you want to add support for additional filter tokens that user will be able to use as time in DateTime filters. Parses and translates a time token into a time filter.
[IntegrationEvent(False,False)]
internal procedure OnResolveTimeTokenFromDateTimeFilter(TimeToken: Text, var TimeFilter: Time, var Handled: Boolean)
Parameters
| Name | Type | Description |
|---|---|---|
| TimeToken | Text |
The time token to resolve, for example: "Lunch". |
| TimeFilter | Time |
The text to translate into a properly formatted time filter, for example:"12:00:00". |
| Handled | Boolean |
Stores whether the operation was successful. |