.NETGURU
passing parameters to crystal reports
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-crystal' list.


Irene Reid
-- Moved from [aspngfreeforall] to [ngfx-crystal] by Marcie Jones <Click here to reveal e-mail address> --

I have a webpage that uses a calander control to allow a date selection. I
pick up the date and server.transfer to another webpage which contains a
crystal report viewer.

The report viewer kicks up the crystal report. The crystal report has a
parameter field WantedDate which it uses in an SQL select. My question is,
how can I auto load this parameter field with the parameter coming from the
first webpage.

I really dont want to revert to having the crystal report prompt for user
input of the date, as the calander control fits so nicely into my
requirement. But I cant see how to get the values into the parameter
fields.

Any help would be really appreciated
thanks

Irene

Reply to this message...
 
    
Domina Tang
Hi, Irene

1) To tranfer selected date to another webpage, you can put calander control
value to Session variable Or write script like:
Server.Transfer("abc.aspx?wantedDate=22/07/2002")

2) To tranfer parameter to crystal report, the script should like this:

protected void SetParameterFields ()
{
ParameterFields paramFields = CrystalReportViewer1.ParameterFieldInfo;
ParameterField paramField = paramFields["WantedDate"];
ParameterValues curValues = paramField.CurrentValues;
ParameterDiscreteValue discreteValue = new ParameterDiscreteValue();
discreteValue.Value = Request.QueryString("wantedDate") Or
Session("WantedDate")
curValues.Add(discreteValue);
CrystalReportViewer1.ParameterFieldInfo = paramFields;
}

I didn't test above code, hope it works.
Domina

-----Original Message-----
From: Irene Reid [mailto:Click here to reveal e-mail address]
Sent: Tuesday, July 23, 2002 10:56 AM
To: ngfx-crystal
Subject: [ngfx-crystal] passing parameters to crystal reports

-- Moved from [aspngfreeforall] to [ngfx-crystal] by Marcie Jones
<Click here to reveal e-mail address> --

I have a webpage that uses a calander control to allow a date selection. I
pick up the date and server.transfer to another webpage which contains a
crystal report viewer.

The report viewer kicks up the crystal report. The crystal report has a
parameter field WantedDate which it uses in an SQL select. My question is,
how can I auto load this parameter field with the parameter coming from the
first webpage.

I really dont want to revert to having the crystal report prompt for user
input of the date, as the calander control fits so nicely into my
requirement. But I cant see how to get the values into the parameter
fields.

Any help would be really appreciated
thanks

Irene

| [ngfx-crystal] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-crystal.asp = JOIN/QUIT

Reply to this message...
 
    
Ron vind
Domina Hello,
I saw the code that you wrote, I did exactly the same.
but in a strange way the follwoing line:
ParameterFields paramFields = CrystalReportViewer1.ParameterFieldInfo; --> returns null.

I have a connection to the database, i defined a parameter field in the Rpt class.
I have no idea why it doesn't work.
When i use the CrystalReportViewer1.selectionFormula, I can manipulate the fields which were defined in my report.
If you have any idea, please let me know.
thanks,
Ron

--------------------------------
From: Ron vind
Reply to this message...
 
    
Irene Reid
Hi there

Thanks for all your help. I am now happilly tossing parameters into my
report and its behaving as it should.

Irene

-----Original Message-----
From: Domina Tang [mailto:Click here to reveal e-mail address]
Sent: 23 July 2002 21:28
To: ngfx-crystal
Subject: [ngfx-crystal] RE: passing parameters to crystal reports

Hi, Irene

1) To tranfer selected date to another webpage, you can put calander control
value to Session variable Or write script like:
Server.Transfer("abc.aspx?wantedDate=22/07/2002")

2) To tranfer parameter to crystal report, the script should like this:

protected void SetParameterFields ()
{
ParameterFields paramFields = CrystalReportViewer1.ParameterFieldInfo;
ParameterField paramField = paramFields["WantedDate"];
ParameterValues curValues = paramField.CurrentValues;
ParameterDiscreteValue discreteValue = new ParameterDiscreteValue();
discreteValue.Value = Request.QueryString("wantedDate") Or
Session("WantedDate")
curValues.Add(discreteValue);
CrystalReportViewer1.ParameterFieldInfo = paramFields;
}

I didn't test above code, hope it works.
Domina

-----Original Message-----
From: Irene Reid [mailto:Click here to reveal e-mail address]
Sent: Tuesday, July 23, 2002 10:56 AM
To: ngfx-crystal
Subject: [ngfx-crystal] passing parameters to crystal reports

-- Moved from [aspngfreeforall] to [ngfx-crystal] by Marcie Jones
<Click here to reveal e-mail address> --

I have a webpage that uses a calander control to allow a date selection. I
pick up the date and server.transfer to another webpage which contains a
crystal report viewer.

The report viewer kicks up the crystal report. The crystal report has a
parameter field WantedDate which it uses in an SQL select. My question is,
how can I auto load this parameter field with the parameter coming from the
first webpage.

I really dont want to revert to having the crystal report prompt for user
input of the date, as the calander control fits so nicely into my
requirement. But I cant see how to get the values into the parameter
fields.

Any help would be really appreciated
thanks

Irene

| [ngfx-crystal] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-crystal.asp = JOIN/QUIT

| [ngfx-crystal] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-crystal.asp = JOIN/QUIT

Reply to this message...
 
 




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification