Working With @Request Tokens
A Logi report or process that uses @Request tokens within its definition is "expecting" to receive these token from whatever calls it. Developers can independently test reports to see what Request variables are expected by adding the request parameter &rdPrompt=True to the end of the URL used to call it.
As shown above, when that request parameter is present in the URL, a special page with a form will be displayed with text input fields for every Request variable that the report or process is expecting. The developer can fill in the values and then run the report using them.
The above is also an example of how a request parameter can be used as a "switch" to toggle some feature on or off; this is often useful for showing or hiding elements in applications.
Similarly, if a report is expecting request parameters, the Test Parameters panel in Studio, shown above, will be visible beneath the Attributes panel and can be used to enter values for testing purposes.
As shown above, the diagnostic Debugger Trace page (accessible when debugging is turned on) shows the @Request tokens and their values.
Target.Report elements have a Request Forwarding attribute, as shown above. When set to True, all of the request parameters that were sent to the current report will be forwarded to the target report when the button is clicked.
This may sound like good thing, but it should be used with caution, because the application may pass system request parameters in addition to those that you specify and the query string may wind up getting very lengthy, especially if a sequence of reports keeps forwarding their parameters. This can be problematic because some browsers have a length limit on the URL they can handle (see Query String Limits).
It's a good practice to actively manage your request parameters, rather than using Request Forwarding, to ensure that you know what's getting passed and when.
Using Default Request Parameters
Imagine a report that lists salespeople based on their year-to-date sales volume and uses this SQL query:
- SELECT TOP @Request.inpRowsToShow~ FROM SalesStaff ORDER BY YTDSales DESC
The report page includes an Input Text element, that has an ID of inpRowsToShow, so that at runtime the user can specify the number of rows to be shown in the report's Data Table. The report calls itself when a button is clicked, in order to refresh the data displayed.
In order to ensure that @Request.inpRowsToShow~ has a value in the SQL query, so that some data is retrieved the first time the report is displayed, a Default Request Parameters element can be included at the top of the report definition. Its attributes define an inpRowsToShow parameter with a value of 25, as shown above.
If no request parameter with the name inpRowsToShow is passed in the query string that calls this report or as a form field, then the value defined in the Default Request Parameters element will be used. If such a request parameter or form field does exist, then its value will be used and this element will be ignored. This ensures that, in any case, when the report is displayed at least the top 25 records in the query will be shown.
Multi-Instance Dashboard Panels and Instance IDs
If Dashboard Panels are configured to be "multi-instance" panels, they're assigned individual "instance IDs" when they're added to a Dashboard. These IDs are used to ensure that they're uniquely identified - essential if a panel is used multiple times in the same Dashboard.
To avoid confusion, request variables generated by these Dashboard panels are passed with their instance ID appended to them, in the format RequestVar_InstanceID. Here's an example of what one of these request variables looks like in the Debugger Trace page:
In order to work with these request tokens, use the special token @Function.InstanceID~ to get the ID for the panel. Then pass that value as a request parameter to your next process task or report and use it with your input element's request token. For example: @Request.lstEmployeeName~_@Request.pnlInstanceID~
An easy way to do that is to use a Default Request Parameters element in your dasboard panel to set a default request variable to something like pnlInstanceID = @Function.InstanceID~.