Custom Filter Functions provide the ability to make functions that will dynamically calculate a value for a filter using high level code.
Filter Functions written in C# and VB.Net can get and set elements from the current session of Exago, such as Parameter values. See Exago Session Info for more information.
Creating Filter Functions
To create a custom function, highlight the Filter Functions tab within the Extensions menu of the Admin Console and click Add.
Each Custom Filter Function has the following properties:
A name for the filter function that will be displayed to the end users.
A description of the filter.
Note: To support multi-language functionality, if the filter function’s name or description can be prepended with ‘_wrFunctionId’. If this ID matches the ID of any element in the language files, then the string of that language element will be displayed to the user instead of the function name/description. For more information see Multi-Language Support.
Determines the data type that the filter function should be available for. This includes date values, strings, integers, and decimals.
The order the filter function will appear among other filter functions of the same type. Functions with a lower number will appear higher on the list. If two functions have the same list value they will display in alphabetic order.
Note: All of the built in filter functions start with list value 100 or greater.
A semicolon-separated list of any .dlls that need to be referenced by the Custom Filter Function. If the .dlls are not accessible in the GAC then the .dlls must be copied to the 'Bin' folder of Exago or the reference should point to their physical path.
Note: System.dll does not need to be listed as a reference as it is already available.
The program code for your Custom Filter Function. The code must return the data type that was set in the Filter Type setting.
Note: Parameters may be referenced within custom functions by placing their name between @’s.
A Custom Filter Function that returns the date value of the last day of the current quarter
Press the Test custom code execution icon to verify that the code properly executes.
The following is an example of a Custom Filter Function that calls the database to generate the average value of a field so it can be used as a benchmark for a filter. This Custom Filter Function will be used to simulate a threshold for the average discounted price off all Orders.
Description: Average Filter Benchmark: Calls the database to generate the average value of a field so it can be used as a benchmark for a filter.
Filter Type: Decimal
List Order: 100
//Establish connection with the Data Source
DbSqlHandler sql = new DbSqlHandler(
//Set SQL statement
//Take an average of the discount of all order detail records
sql.Stmt = String.Format("SELECT AVG(Discount) FROM OrderDetails");
//Send the SQL off to the Data Source
DataSet ds = sql.ExecuteReadCmd();
//Return the average value