Retrieving Data from the Request Object
To understand how we use data from the request object, let's return to the <csp:query> tag we looked at earlier. There are two key elements.
First, whenever a page is being constructed, the variable %request refers to the current %CSP.RequestOpens in a new tab object.
Second, the Data property is used to retrieve a value by name. For instance
%request.Data("FilmID",1)
would return the value of the FilmID name-value pair. The second parameter, 1, indicates that we want the first value for FilmID. (In some cases, such as multi-selection lists, multiple values can be returned.)
If you forget the second parameter you will not find any data. Also, it is a good idea to use the ObjectScript $Get function which guarantees a value will be returned even if a variable is not defined.
$Get(%request.Data("FilmID",1))
We use this within the CSP:QUERY tag as follows:
ShowTimes.csp
<csp:query
name="Times"
classname="Cinema.Show"
queryname="ShowTimes"
P1='#($Get(%request.Data("FilmID",1)))#'>