Scroll

Custom Filter Execution Window

When a report is executed, a filter execution dialog will appear if any of the filters on the report are set to ‘Prompt for Value’. This dialog can be replaced with a custom window created by the host application. The custom window can be either a control saved within Exago or a separate webpage outside of Exago

To create Custom Filter Execution Window as a control within Exago:

  1. Create an ascx file in the installation directory of Exago. Ex CustomFilterWindow.ascx
  2. Set the control, height and width in the Custom Filter Execution Window parameter in the Filter Settings. Ex control=CustomFilterWindow.ascx;height=100;width=300;
NOTE. Height and Width are numbers that represent the dimensions of the window in pixels. These settings are optional. If omitted, the dialog is sized to the value in the wrDialogMasterContainerCentered css class, which is currently 70%.
  1. In the control use the JavaScript functions described below to show the custom filter window and create or modify filters before report execution begins.

To create Custom Filter Execution Window as a web page:

  1. Set a URL, height and width in the Custom Filter Execution Window parameter in the Filter Settings. Ex url=www.CustomFilterExecution.com;height=100;width=300;
NOTE. Height and Width are numbers that represent the dimensions of the window in pixels.
NOTE. To notify the host application the user’s language the URL will be appended with the ‘Language File’ of Main Settings and a context parameter (listed below). Ex. www.CustomFilterExecution.com?language=en-us
  1. In the custom webpage use the JavaScript functions described below to show the custom filter window and create or modify filters before report execution begins.
NOTE. all the JavaScript functions must begin with ‘parent.’ as the page is placed inside an iFrame by Exago.

Available JavaScript Functions

The following JavaScript functions are available for the Custom Filter Execution Window.

object[] wrGetFilterWindowData()

Description

Gets the report’s existing filters created in Exago as an array.

Remark

Returns an array of filter objects. For more information on the filter objects see wrReportFilter().

object[] wrGetFilterWindowDataObjects()

Description

Gets the Data Categories of the report and their associated Data Fields.

Remark

Returns an array of representing the available Data Categories.
Each Data Category has a string providing its Name and a sub array representing the Data Fields.
Each Data field has a string providing its Name and an integer representing its Data Type. This integer uses the Data Type Constant described below.

DataType Constants:
0 - String

1 – Date

2 – Integer

3 - Bit

4 - Numeric

5 - Float

6 - Decimal

7 - Guid

8 - DateTime

9 – Time - not currently used
10 - Image

NOTE. All the Categories names being passed are the Alias for each Data Object. Similarly the Data Fields will return the name specified in column metadata if provided.

string wrGetActiveReportName()

Description

Returns the name of the report being executed.

Remark

The returned string includes the folder path of the report separated by slashes.

bol wrShowFilterWindow()

Description

Displays the custom filter execution window.

void wrReportFilter()

Description

Creates a Filter object that can be added to the Filters array returned by wrSetFilterWindowData().

Remark

Filter Objects have the following properties:

Name – The name of the data field being used.
Operator – Operator for filter. Uses enumeration wrFilterOperator
Values – Value(s) of filter
AndFlag – Boolean to set And/Or with next filter.
GroupWithNext – Boolean to group with next filter.
GroupStartCount – The number of opening parentheses that were manually added to the filter using ctrl + [.
GroupEndCount – The number of closing parentheses that were manually added to the filter using ctrl + ].
DataType – the type of data being filtered. Uses constants DataType (see below.

DataType Constants:
0 - String

1 – Date

2 – Integer

3 - Bit

4 - Numeric

5 - Float

6 - Decimal

7 - Guid

8 - DateTime

9 – Time - not currently used

10 - Image

bol wrSetFilterWindowData(object[] filters)

Description

Sets the filters for the report, closes the custom filter execution window, and then begins report execution.

Remark

Returns a Boolean to indicate success.

This or wrCancelFilterWindow() should be the last function called by the custom filter execution window.

bol wrCancelFilterWindow()

Description

Closes the custom filter execution window without changing the report’s filters.

Remark

Returns a Boolean to indicate success.

This or wrSetFilterWindowData() should be the last function called by the custom filter execution window.

Example Custom Filter Execution Control

<%@ Control Language="C#" ClassName="MyCustomFilterDialog" EnableTheming="false" %>
<span>Hello Custom Filter Dialog</span>
<input type="button" value="Ok" onclick="OnOk();" />
<input type="button" value="Cancel" onclick="OnCancel();" />
<script type="text/javascript">
   OnOk = function()
   {
   	// create array of wrReportFilter objects to send back to parent
   	var filters = new Array();
   	var filter = new wrReportFilter();
   	filter.Name = "Employee.First Name";
   	filter.Operator = wrFilterOperator.OneOf;
   	filter.Values.push("Travis");
   	filter.Values.push("Stew");
   	filters.push(filter);
   	wrSetFilterWindowData(filters);  // also continues execution
   }
   OnCancel = function()
   {
   	wrCancelFilterWindow();
   }
   // initialize custom window with values from the parent
   var filters = wrGetFilterWindowData();
   var dataObjects = wrGetFilterWindowDataObjects();
   wrShowFilterWindow();
</script>

Example Custom Filter Execution WebPage

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server"></script>
<html xmlns="http://www.w3.org/1999/xhtml">
   <head runat="server">
      <title></title>
      <script type="text/javascript">
         window.onload = function() { Initialize(); };
         function Initialize()
         {
                // initialize custom window with values from the parent
                var filters = parent.wrGetFilterWindowData();
                var dataObjects = parent.wrGetFilterWindowDataObjects();
                parent.wrShowFilterWindow();
         }
         function OnOk()
         {
                // create array of wrReportFilter objects to send back to parent
                var filters = new Array();
                var filter = new parent.wrReportFilter();
                filter.Name = "Employee.First Name";
                filter.Operator = parent.wrFilterOperator.OneOf;
                filter.Values.push("Travis");
                filter.Values.push("Stew");
                filters.push(filter);
                parent.wrSetFilterWindowData(filters);  // also continues execution
         }
         function OnCancel()
         {
                parent.wrCancelFilterWindow();
         }
      </script>
   </head>
   <body>
      <form id="form1" runat="server">
         <div>
            <input type="button" value="Ok" onclick="OnOk();" />
            <input type="button" value="Cancel" onclick="OnCancel();" />
         </div>
      </form>
   </body>
</html>
 

Hidden Article Information

Article Author
Alex Agoado
created 2015-12-15 18:32:51 UTC
updated 2016-01-05 21:07:47 UTC

Labels
filter window, custom filter, prompt for value,
Have more questions? Submit a request