Solved

Programmatically adding crystal report parameters in web page(ASP.NET)

Posted on 2007-11-20
9
2,601 Views
Last Modified: 2013-11-26
I would like to add parameters to filter based on user's selection.  I have used a stored procedure to load the crystal report.  The parameter is the same as the input parameter used in the stored proc.  For some reason the report does not allow any parameter choosing option on the web page, while it executes just fine when I run the report by itself (as a Crystal report).  

Thanks,

SunDevil
0
Comment
Question by:SunDevilProgrammer
  • 5
  • 4
9 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 20325534
It should prompt for the stored procedure parameter.

Is the parameter simply for filtering?

Yes, you can pass parameters to the report from an ASP page.

Display the FIELD EXPLORER
Right Click PARAMETER
Click NEW
FIll in the form

Save it

CLick REPORT
CLICK SELECT EXPERT
Select the field
Select the comparison
Select the parameter

mlmcc
0
 

Author Comment

by:SunDevilProgrammer
ID: 20328430
I did all of that but still am not prompted for a value when I run the app.  I get the report for the same parameter value every time and does not allow me to chcange the parameter value.  The purpose of using a parameter seems to be lost.  I am assuming I have to programmatically include the parameter option.  Something like..."ParameterFields"  or something of the sort...

HELP!!
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 20330719
Do you have the report saved with data?
Open the report
Click FILE
Ensure SAVE DATA WITH REPORT is not checked.

Try hitting the REFRESH button on the viewer.

mlmcc
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:SunDevilProgrammer
ID: 20345929
I have done everything described and am now getting an error that says "List of Values Failure. Fail to get values. Cause of Error: [Length of parameter field current values must be less than or equal to the maximum value.]"

The DataType of the field i sVarchar2(15Byyte) and I have no way to modify this.

Thanks
SunDevil
0
 

Author Comment

by:SunDevilProgrammer
ID: 20346122
Also, I would liek to mention here that although the parameter, when set to be Dynamic, produces the said error, but when set to Static, works just fine.  But I would like for the parameter field to get populated from the database and not let the user type in the values.

Woudl I be able to do it using VB code in the ASP page?
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 20346463
If you want it to be populated from the database you have to ensure all values in the database match the parameter type.

mlmcc
0
 

Author Comment

by:SunDevilProgrammer
ID: 20346639
The dtabase has a VARCHAR2 datatype, but the only equivalent datatype in the parameter definition form is the String.  Is this what you are referring to?  Also, I noticed a snippet requiring to instantiate the report object as ..
Dim MyReport as new CrystalReport1
I want to know if "CrystalReport1" in this context is teh name of the report I created.  

I am sorry to be confused over an issue that is rather simple.  But the fact that this is so eluding tells it is not a simple problem anymore.  But with your help, it should be!

SunDevil

0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 20346784
Varchar is the same as string for Crystal.

CrystalReport1 is the object related to your report when you bring it into the applicaiton.

mlmcc
0
 

Author Comment

by:SunDevilProgrammer
ID: 20355686
Code that worked:
In the Load event of the page...

Dim Report as New ReportDocument()
Report.Load("C:\Documents and Settings\MyReport")
Report.SetDatabaseLogon("username", password")
CrystalReportViewer1.ReportSource = Report

I still need clarification on SetParameterValue method.

Is it necessary to go through the process in the report creation phase and still declare programmatically or can you avoid setting it in the report and directly code in the code-behind page?

Thanks,

SunDevil
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question