Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change parameters on report refresh

Status
Not open for further replies.

seamonkey

Programmer
Feb 11, 2003
11
0
0
GB
I am currently developing a csp page that will allow the user to re-run an on-demand report from the viewer by selecting different values for the parameters. However, I want it to start off with the parameters that the user last specified.

What I have written so far opens up a pop-up window and displays the parameters but I cannot get it to display the existing values.

This is the pertinent code that I've nicked from Crystal's own help files somewhere but it only ever returns the "There are no current values for this parameter." message. Has anyone got any ideas?


Dim MyQuery1
MyQuery1 = "SELECT * FROM CI_INFOOBJECTS WHERE SI_ID=" & MyReportID

Dim Result
Set Result = MyInfoStore.Query(MyQuery1)

'Retrieve the report returned.
Dim ReportObject
Set ReportObject = Result.Item(1)

'Retrieve the report interface.
Dim ReportInterface
Set ReportInterface = ReportObject.PluginInterface

'Display the default values for the first parameter in a report
Dim value
If ReportInterface.ReportParameters.Count > 0 Then
If ReportInterface.ReportParameters.Item(1).CurrentValues.Count > 0 Then
Response.Write &quot;The default values for the first parameter in this report are: <BR>&quot;
For each value in ReportInterface.ReportParameters.Item(1).CurrentValues
Response.Write &quot; &quot; & value.MakeDisplayString & &quot;<BR>&quot;
Next
Else
Response.Write &quot;There are no current values for this parameter. <BR>&quot;
End If
Else
Response.Write &quot;This report does not have any parameters.<BR>&quot;
End If
 
What the code you have shown does is display the default values for the parameters... not the most recently used. Does the report have default values? Try setting some and see if it works then. You can then &quot;set&quot; the default values for the parameters and use this code. There is also code to return the current value.. I unfortunately do not remember it at the moment.

Lisa
 
Thanks Lisa, but I disagree ! The code shown does (or is supposed to!) show the current values. As this snippet below
shows it has the &quot;CurrentValues&quot; object reference not &quot;DefaultValues&quot;.

For each value in ReportInterface.ReportParameters.Item(1).CurrentValues

I think you may have been confused by the comments and the response.write bit which IS wrong but of no consequence. I remember now that I had nicked the code that displayed the default values and modified it to show current values. Though not very successfully!

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top