SQL Select Statement - Parameters Tab

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

SQL Select Statement - Parameters Tab

Previous pageReturn to chapter overviewNext page

 

The Parameters tab of the SQL Select Statement dialog allows you to define parameters that are placeholders for values that are substituted into the Where clause of the SQL statement right before the statement is sent to the server.   This feature is primarily useful when you are building a report to use with ReportPro's runtime engine and need to modify the SQL Select statement based on user input from your application.  Parameters can also play an important role when you are developing a report that has triggered sections.

 

The figure below shows the Parameters tab with one parameter defined.  Each parameter has a name that is shown in the first column and an expression that is evaluated to get the value that is substituted into the SQL statement.

 

_bm57

 

To create a new parameter, click the _bm31 button in the lower right corner, and ReportPro will add another row to the parameter list. ReportPro defaults the parameter name to "PX" where X is the number of parameters in the list.  You can rename the parameter by clicking on the parameter name and typing in the desired name.

 

After you have named your parameter, the next step is to specify its expression.  It is important to note that the expression is a ReportPro expression and as a result must be specified in ReportPro syntax not in SQL syntax.  This expression is executed locally by the ReportPro engine before the SQL Select statement is sent to the server.  In the upper right corner of the expression column is a small button, which when clicked, displays ReportPro's Expression Builder.  It is recommended that you use the Expression Builder to generate the expression, as it is easier to test the syntax to insure that it is correct.

 

Once you have defined a parameter, you can use it as part of the SQL Select filter clause by delimiting the parameter name with the % character.  For example:

 

"DBA"."Customer"."fname" = %P1%

 

If you wish to delete a parameter, simply highlight the desired row and click the _bm58 button.  

 

 

Also See:

 

SQL Select Statement