Solved

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

Posted on 2007-11-20
9
2,605 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 101

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 101

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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 

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 101

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 101

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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

729 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