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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Viewer with ASP.Net - Subreport Parameters

Status
Not open for further replies.

blipper

Programmer
Jan 8, 2004
9
GB
I am trying to view a report which contains sub-reports in a dot net Crystal Viewer component using Crystal 10. I cannot work out how to pass in parameters to the subreports. My basic code will show any report without subreports, but as soon as I look at a report with subreports (with parameters), it falls over.

Please help.
 
Hello
Are you linking the subreports to the reports using these parameters?
This should pass the parameters into the subreports...
Hope this helps...
B~


Boni J. Rychener
Hammerman Associates, Inc.
Crystal Training and Crystal Material
On-site and public classes
Low-cost telephone/email support
FREE independent Crystal newsletter
800-783-2269
 
Yes the subreport parameters are linked to the main reports parameters. This report runs fine in a crystal viewer using the Web Component service on v8 and runs fine in the client for 10 (converted and saved as v10).

I get the following comment in the viewer component when I try to run it:

ParameterList -
Use the ParameterFieldInfo property to specify parameter fields.

Hope this helps.
 
To set a parameter value in a Windows app:
Code:
Dim crParameterFields As ParameterFields 
Dim crParameterField As ParameterField 
Dim crParameterDiscreteValue As New ParameterDiscreteValue() 
Dim crParameterValue As ParameterValue 

crParameterFields = CrystalReportViewer1.ParameterFieldInfo 
crParameterField = crParameterFields(0) 
crParameterDiscreteValue.Value = "Canada" 
crParameterField.CurrentValues.Add(crParameterDiscreteValue) 
CrystalReportViewer1.ParameterFieldInfo = crParameterFields 
CrystalReportViewer1.Reportsource = EnterpriseReport1
To set a parameter value in a web app:
Code:
Dim crParameterFields As ParameterFields 
Dim crParameterField As ParameterField 
Dim crParameterDiscreteValue As New ParameterDiscreteValue() 
Dim crParameterValue As ParameterValue 

CrystalReportViewer1.Reportsource = EnterpriseReport1 
crParameterFields = CrystalReportViewer1.ParameterFieldInfo 
crParameterField = crParameterFields(0) 
crParameterDiscreteValue.Value = "Canada" 
crParameterField.CurrentValues.Add(crParameterDiscretValue) 
CrystalReportViewer1.ParameterFieldInfo = crParameterFields

Hope this helps!
B~


Boni J. Rychener
Hammerman Associates, Inc.
Crystal Training and Crystal Material
On-site and public classes
Low-cost telephone/email support
FREE independent Crystal newsletter
800-783-2269
 
Hi,a I have the same problem, and my code is:

crConnectionInfo.ServerName = getRegistryKey("Server","172.16.0.117");//"172.16.0.117";
crConnectionInfo.DatabaseName = getRegistryKey("db","Informador");//"Informador";
crConnectionInfo.UserID = getRegistryKey("User","sa");//"sa";
crConnectionInfo.Password = getRegistryKey("Pass","saei");//"saei";
CRDatabase = reportDocument1.Database;
crTables = CRDatabase.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
{
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);
crTable.Location=crTable.Name+";1";
}
CrystalReportViewer1.ReportSource = reportDocument1;
crParameterFields = CrystalReportViewer1.ParameterFieldInfo;
int iconta=0;
while ( myEnumerator2.MoveNext() )
{
crParameterField = crParameterFields[iconta];
crParameterDiscreteValue.Value = myEnumerator2.Current.ToString();
crParameterField.CurrentValues.Add(crParameterDiscreteValue) ;
iconta++;
}
CrystalReportViewer1.ParameterFieldInfo = crParameterFields;

could you help me please?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top