Runtime Parameters
??:<key>
Runtime parameters are parameters which are specified when the user first enters an application, and can then
apply to all operations executed by that user. For example, let’s say you have sales offices in three different
locations: Atlanta, Boston, and Cleveland. You want to develop a WOW application containing various operations
which let people from each branch run different queries against sales made by their branch. You could include
the branch name in each query using regular SQL parameters like this:
SELECT * FROM PJDATA.SALES WHERE BRANCH = ? AND AMOUNT > ?
SELECT * FROM PJDATA.SALES WHERE BRANCH = ? AND DATE = ?
SELECT * FROM PJDATA.SALES WHERE BRANCH = ? AND ACCOUNT = ?
The only problem with this scenario is it forces users to select their branch for every query that is run. If you
rework these queries to use run-time parameters instead, then the branch can be specified once when the
application starts up and used for all subsequent queries without further user input.
Two question marks followed by a colon “:” and an identifying name is the sequence used to indicate a runtime
parameter. Using runtime parameters for the branches in the above queries gives:
SELECT * FROM PJDATA.SALES WHERE BRANCH = ??:BCH AND AMOUNT > ?
SELECT * FROM PJDATA.SALES WHERE BRANCH = ??:BCH AND DATE = ?
SELECT * FROM PJDATA.SALES WHERE BRANCH = ??:BCH AND ACCOUNT = ?
To specify a value for the BCH run-time parameter, the application should be started with a URL like this:
http://www.planetjavainc.com/wow/runApp?id=40&BCH=Atlanta
This starts up application 40 and indicates that "Atlanta" is the value for all run-time parameters named "BCH".
The '?' denotes the start of parameters and '&' is used to separate parameters. Users from different branches
can use links specifying their branch when starting the application:
http://www.planetjavainc.com/wow/runApp?id=40&BCH=Boston
http://www.planetjavainc.com/wow/runApp?id=40&BCH=Cleveland
When they run the operations, they will not have to select which branch they are querying.
Multiple value support has been added to runtime parameters as of WOW version 7.1. This means that for SQL IN queries, the user can add multiple, comma-separated values to the URL in a situation where that is warranted. For example, lets say we want to query multiple branches in the following SQL:
SELECT * FROM PJDATA.SALES WHERE BRANCH IN ??:BCH
To specify multiple values for the BCH runtime parameter, the application should be started with a URL like this:
http://www.planetjavainc.com/wow/runApp?id=40&BCH=Atlanta,Boston,Cleveland
This URL will launch application with an id of 40 and return all results from the SALES table where the BRANCH field contains the value Atlanta or Boston or Cleveland.
Request Parameters
??%<parameter name>
Request parameters are parameters which get their values from the HttpRequest. For example,
lets say you had some HTML (in a JSP or in Operation instructions) similar to this:
<input type="text" name="myInput" />
<input type="hidden" name="myHiddenInput" value="1998" />
In your operation you could then use a Request parameter to get the values from the HTML.
Two question marks followed by a percent sign “%” and an identifying name is the sequence
used to indicate a Request parameter. So, from the above example, if you used the
parameter ??%myHiddenInput in your SQL, the value returned for the parameter will be 1998.
If, in turn, you used ??%myInput as the parameter in your SQL, the value returned for the
parameter would be whatever value the user entered in the input.