There are two pieces required to support dynamic filtering using the Variable Replacement method: Filter Variables in the displays and End-User Filter Selection, which passes the call to the data display and passes the filter variables.
With this method, a filter is added to a display and a variable is established. The sample below shows a filter that is set up to support two variables for the Status and Stage of documents.
Note that the syntax is [%Variable%] where "Variable" is the name of the variable that will be passed in via the URL. The variable can be named whatever you want; you just need to make sure the call to the variable references the same variable name.
By creating two conditions using the "Or" option, two different sets of variables can be supported.
• The display cannot be on a page with an iFrame. The display must be directly available on a page.
o The display often appears in a pop-up window, either a modal dialog or a new window. This is especially common when using Dynamic Filtering with emails.
• The display can be located anywhere; the call does not have to be on the page.
Using the display set up above as an example, say you want to display all of the documents that have a Status of “Released” and a display is located on a page at http://www.abc.com/default.aspx. The URL string to make this request would be http://www.abc.com/default.aspx?SelectStatus=Released where
• SelectStatus is the name of the variable identified on the display's Filter page and
• Released is the value
The simplest way to use this method is to provide a text link. When a user clicks on the link, they will see the requested information in the display. A sample of this configuration is shown below. The user may click one of the two static options, "Released" or "In Process."
There are many different ways to create a dynamic filter UI. Some of these include:
• Add a Content Editor web part with a hard-wired request (as shown above)
• Use a Data Viewer web part with a drop-down to make the request
• Use HTML with JavaScript to allow for the selection and pass the request
• Use HTML with JavaScript to concatenate multiple criteria into one request
• Use the CorasWorks Business Data Form Adapter (BDF) to create a request of multiple drop-downs
NOTE: In order to pass parameters, the display must be configured to support the requests by defining the variables on the Filter page; the variables must be available in the display.
The term "complex scenarios" means that multiple variables are referenced. For instance, a query that contains two variables can be passed. A few scenarios and the syntax using variable replacements are provided below.
In this example, we want to return documents that have a Stage of "Draft" and a Status of "Review." First, these variables are defined in the Display Wizard using the "AND" condition so the query filters for both of the two conditions. With this example, the query would be:
http://www.abc.com/default.aspx?SelectStage=Draft&SelectStatus=Review
SelectStage and SelectStatus are the two variables that are configured in the Display Wizard. You can name them whatever you wish.
NOTE: When using multiple variables in an "AND" condition, all variables must be valid.
In the next example, there is a need to return all documents assigned to the current user. CorasWorks supports a variable called [Me]. To use this variable, define a filter condition within the Display Wizard such as Assigned To | is equal to | User (shown below), where "User" is the variable name.
The syntax of the query would be: http://www.abc.com/default.aspx?User=[Me]
The system will replace [Me] with the current user's name.
As another example, say you want to find the documents that are assigned to the current user and in the Draft stage. First, the two variables must be set up in the display. If the variables were named User and SelectStage, the query would be: http://www.abc.com/default.aspx?User=[Me]&SelectStage=Draft
Dates are also supported. For example, a query can be run to look for documents with a Date Released that is greater than or equal to a target date. First, a variable would be defined on the Filter page. If the variable is set up as Date Released | is greater than or equal to | TargetDate (the variable name), the query would be:
http://www.abc.com/default.aspx?TargetDate=02/14/2010
With this example, the display would show all documents where the Date Released is greater than or equal to 02/14/2010.
CorasWorks also supports the Today variable. Using the same example as above, the Today variable could be used instead of a set date. The Filter page setup would be the same, but the query would be:
http://www.abc.com/default.aspx?TargetDate=[Today]
This will find all documents with a Date Released that is greater or equal to the current system date.