Solved

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

Posted on 2007-11-20
9
2,596 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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now