 |
| Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

September 17th, 2006, 08:03 PM
|
|
Registered User
|
|
Join Date: Sep 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Crystal Report Parameter Problem
I have written a web application to display all parameters in a crystal report when selected and display the report.
In one of my reports I have a parameter called Rank. This parameter accepts values from 1 - 3. I have added these values in the set default values in crystal.
Also to make it readable to user, for each value I have added the description (Excellent for 1, Good for 2 and , Average for 3).
So when the report is refreshed in crystal it shows the Description instead of the values.
I have 2 problems.
1. In my web application, I cannot show the description of default values in my application. My code displays only the default values. I am not sure how to get the Description to show.
2. When I display the report, crystal report viewer alocates a certain area for the Group Tree.
Is it possible to change the width of this?
I am using Visual Studio.NET 2003 with Crystal 9 (Which is included in the Visual Stuydio installation)
Dim reportname As String = Server.MapPath("") & "\crystalreport1.rpt"
Dim rpt As New ReportDocument
rpt.Load(reportname)
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
crParameterFieldDefinitions = rpt.DataDefinition.ParameterFields()
Dim i As Integer = 0, j As Integer = 0
For i = 0 To crParameterFieldDefinitions.Count - 1
For j = 0 To crParameterFieldDefinitions.Item(i).DefaultValues. Count - 1
Response.Write(crParameterFieldDefinitions.Item(i) .DefaultValues(j))
Next
Next
I am stuck with this for the past 2 months.
Any help is greatly appreciated.
donsls
|
|

September 17th, 2006, 09:40 PM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
First, the Tree is always displayed on the left hand side of the CR Viewer control and I know of no way to change that.
What do you mean by Description? You mean what you have named your field in Crystal?
--Stole this from a moderator
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
|
|

September 18th, 2006, 05:49 PM
|
|
Registered User
|
|
Join Date: Sep 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
What I mean by Description is:
When you create parameters in Crystal you could enter default values for that parameter. And for each default value, you could enter a description for readability. Ex: My database table has a field called Rank. It accepts integer values (1, 2 and 3). If I create a parameter called rank in my crystal report and enter 1,2 and 3, and when user refheshes the report it will ask the user to select 1, 2 or 3. But the user doesn't know about what these values stand for. So to make user understand this, for each default value in Rank I enter a description. Excellent for 1, Good for 2 and , Average for 3. So user will see only Excellent, Good and Average. I want to get these values in my aspx page. Please help me with this. I am really stumped with this.
donsls
|
|

September 29th, 2006, 05:02 PM
|
|
Registered User
|
|
Join Date: Sep 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
This snippet creates a dropdownlist control for a Crystal
parameter with a list of values. It assumes that there are
no ranges defined for the parameter, only discrete values. The resulting drop down list displays the description, but returns the value of the parameter as the SelectedValue.
Note: crReportDocument is a loaded Crystal ReportDocument object. iParamNumber is the index to the report parameter.
Dim paramField As ParameterFieldDefinition
Dim paramDefaultValues As ParameterValues
Dim paramDefaultValue As ParameterValue
Dim paramDefaultDiscreteValue As ParameterDiscreteValue
Dim paramChoiceValues As ParameterValues
Dim paramChoiceValue As ParameterValue
Dim paramChoiceDiscreteValue As ParameterDiscreteValue
Dim valueNdx As Int16
' Get the specified parameter
paramField = crReportDocument.DataDefinition.ParameterFields(iP aramNumber)
' Get the default values (list of choices) from the parameter field
paramChoiceValues = paramField.DefaultValues
Select Case paramField.ParameterValueKind
Case Is = ParameterValueKind.StringParameter
If paramChoiceValues.Count > 0 Then
' String - choose from list.
Dim ctlInput As New DropDownList
ctlInput.ID = paramField.Name
For Each paramChoiceValue In paramChoiceValues
paramChoiceDiscreteValue = paramChoiceValue
Dim lItem As New ListItem
lItem.Value = paramChoiceDiscreteValue.Value
lItem.Text = paramChoiceDiscreteValue.Description
ctlInput.Items.Add(lItem)
Next paramChoiceValue
end if
Case .....
End Select
|
|

October 10th, 2006, 09:22 AM
|
|
Registered User
|
|
Join Date: Sep 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for the reply. Much appreciated.
donsls
|
|
 |