Click here to Skip to main content
15,893,622 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a Top N crystal reports with Crystal XI. Created a group which will be used for Top N summary. Then I created a parameter which I assigned it in Top N group sort expert.
The problem is The report works perfectly when I change parameter value in .rpt file. But when I pass parameters from .net 2008 it takes default value of the parameter.

What could be wrong?
Can anyone suggest?

Shailesh

Here is the code I use to set the paramaters:
VB
Dim crParameterFieldDefinitions As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions
Dim crParameterFieldDefinition As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition
Dim crParameterValues As New CrystalDecisions.Shared.ParameterValues
Dim crParameterDiscreteValue As New CrystalDecisions.Shared.ParameterDiscreteValue

crParameterDiscreteValue.Value = Value
crParameterFieldDefinitions = objReport.DataDefinition.ParameterFields
crParameterFieldDefinition = crParameterFieldDefinitions.Item("BottomN")
crParameterValues = crParameterFieldDefinition.CurrentValues

crParameterValues.Clear()
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)


[Edit - Transferred code from solution to the question, and added code block.]
Posted
Updated 21-Nov-11 6:04am
v2
Comments
luisnike19 21-Nov-11 11:46am    
How are you passing the paremeter? Show the code
Kschuler 21-Nov-11 12:06pm    
Code has been added to the question.
Kschuler 21-Nov-11 12:05pm    
I moved the code from your solution into the question. If you ever need to add more information to a question click the Improve question link instead of posting a solution.

1 solution

Refresh the report at last, check this tutorial

VB.NET Crystal Reports String parameter[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900