It may be convenient to pre-set some or all Crystal Reports parameter values as part of a web link or when opening a report from another application. ReCrystallize Server supports passing parameter values as part of the URL or POSTing an HTML form with appropriately named fields to the ViewReport.aspx page. When a parameter value is set this way, the user is not prompted to select the parameter value before the report is displayed.

Parameter values may be referenced in either of two ways, by name or by number. Consider an example report named “library.rpt” that has two parameter values: author and title. Author is the first parameter in the report and title is the second. The parameters may be set by name using the syntax

parametername=parametervalue

In the library example report, the link could be:

ViewReport.aspx?reportName=library.rpt&author=Shakespeare&title=Hamlet

This link would set the author parameter value to “Shakespeare” and the title parameter value to “Hamlet”. The user viewing the report would not be prompted for either parameter value before the report is displayed. If only one of the parameter values were passed in this way, the user would be prompted for the other value.

Parameters may also be referenced by number. Recall that author is the first parameter in the report and title is the second. An equivalent link to the one above would be

ViewReport.aspx?reportName=library.rpt&P1=Shakespeare&P2=Hamlet


Parameters with multiple values

When setting multiple values for parameter, separate each value with a comma and enclose each value in quotation marks as shown in the example below. The parameter must be set to accept multiple values in the Crystal Reports designer.

ViewReport.aspx?reportName=library.rpt&promptex-author=Shakespeare&title=”Hamlet”,”Macbeth”



Date values

Use the following format to specify date values:
Date(YYYY,MM,DD)
For example, setting a date value of May 23, 2016, would look something like

ViewReport.aspx?reportName=sales.rpt&day=Date(2016,05,23)

In version 5.8 and later, date values may be formatted in any locally parsable format such as mm/dd/yyyy as in this example

ViewReport.aspx?reportName=sales.rpt&day=05/23/2016


ReCrystallize Pro style date fields are also supported using the format PxY, PxM, PxD where x represents the parameter number, Y is the year, M is the month, and D is the date. For example, &P2Y=2020&P2M=12&P2D=25 is equivalent to P2=Date(2020,12,25).

Last modified: 18 November 2021

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment