Re: How is it possible ...
- From: "AMDRIT" <amdrit@xxxxxxxxxxx>
- Date: Thu, 16 Feb 2006 17:04:31 -0600
Wow, you do all that for Crystal Reports? What is RapportAIRCOStoringen?
Here is all I do for CR
Dim x As CrystalDecisions.CrystalReports.Engine.ReportDocument
x.Load(sReportPath)
'Reports are not embedded resources
x.SetParameterValue("Paramater1", Paramaters(1)) 'Dynamic Paramaters
x.SetParameterValue("Paramater2", Paramaters(2))
x.SetDataSource(mydata) 'Strongly
Typed Datasets
Me.CrystalReportViewer1.ReportSource = x
Me.CrystalReportViewer1.PrintReport()
'Now to answer your question about your code, hmm
Ok, first
Never --> Dim x as new object
'This is silly, lazy and unprofessional. So if you are in high
school, keep the course.
Instead --> Dim x as object
Set x = new object
'Reserve your space and contract
'Then make use of it.
I think this is your problem
myReport.SetParameterValue("FiliaalKeuze", discreteVal)
Why are you setting the crView paramaters and the myReport paramaters?
-->crViewer.ParameterFieldInfo = paramFields
-->myReport.SetParameterValue("Periode", rangeVal)
I think that myReport is the only think that needs to be set
I had to spent time reading your code to understand what you were doing.
Here is an attempt to clean it up.
Private Sub TestIT()
Dim myReport As RapportAIRCOStoringen
Dim paramFields As ParameterFields
Dim paramField As ParameterField
Dim BeginPeriode As String
Dim EindPeriode As String
'Todo wrap everything in try
paramFields = New ParameterFields
Try
BeginPeriode = Request.QueryString("BeginPeriode")
EindPeriode = Request.QueryString("EindPeriode")
Catch ex As Exception
Dim exCustom As ApplicationException
exCustom = New ApplicationException("Unable to parse Query
Paramaters.", ex)
Throw exCustom
End Try
'Todo wrap in try
paramField = CreateParamater("FiliaalKeuze")
paramField.CurrentValues.Add(CreateParameterDiscreteValue(2044))
paramField.CurrentValues.Add(CreateParameterDiscreteValue(2344))
myReport.SetParameterValue("FiliaalKeuze", paramField)
'paramFields.Add(paramField) --> Not needed
'Todo wrap in try
paramField = CreateParamater("Periode")
paramField.CurrentValues.Add(CreateParameterRangeValue(BeginPeriode,
EindPeriode))
myReport.SetParameterValue("Periode", paramField)
'paramFields.Add(paramField)--> Not needed
'Todo wrap in try, i don't think you need this
'myReport.SetParameterValue("Periode", rangeVal)
'myReport.SetParameterValue("FiliaalKeuze", discreteVal)
'Todo, determine if we need this step; I don't think you do
'crViewer.ParameterFieldInfo = paramFields
crViewer.ReportSource = myReport
End Sub
Private Function CreateParamater(ByVal ParamaterName As String) As
ParameterField
Dim paramField As ParameterField
paramField = New ParameterField
paramField.ParameterFieldName = ParamaterName
Return paramField
End Function
Private Function CreateParameterDiscreteValue(ByVal Value As Object) As
ParameterDiscreteValue
Dim paramDiscreteValue As ParameterDiscreteValue
paramDiscreteValue = New ParameterDiscreteValue
paramDiscreteValue = Value
Return paramDiscreteValue
End Function
Private Function CreateParameterRangeValue(ByVal StartRange As Object,
ByVal EndRange As Object) As ParameterRangeValue
Dim paramRangeValue As ParameterRangeValue
paramRangeValue = New ParameterRangeValue
paramRangeValue.StartValue = StartRange
paramRangeValue.EndValue = EndRange
Return paramRangeValue
End Function
"Alison Givens" <info@xxxxxxxxxxx> wrote in message
news:eW4b66tMGHA.668@xxxxxxxxxxxxxxxxxxxxxxx
...... that nobody knows the answer.
I can't imagine that I am the only one that uses parameters in CR.
So, my question again:
I have the following problem.
(VB.NET 2003 with CR)
I have a report with a multiple-value discrete value and a rangevalue.
The report shows fine in the viewer, but when I hit the export to pdf
button, it only uses one of two discrete values.
This is the code:
Dim BeginPeriode As String
Dim EindPeriode As String
BeginPeriode = Request.QueryString("BeginPeriode")
EindPeriode = Request.QueryString("EindPeriode")
Dim myReport As New RapportAIRCOStoringen
Dim paramFields As New ParameterFields
Dim paramField As New ParameterField
Dim discreteVal As New ParameterDiscreteValue
Dim rangeVal As New ParameterRangeValue
paramField.ParameterFieldName = "FiliaalKeuze"
discreteVal.Value = "2044"
paramField.CurrentValues.Add(discreteVal)
discreteVal = New ParameterDiscreteValue
discreteVal.Value = "2344"
paramField.CurrentValues.Add(discreteVal)
paramFields.Add(paramField)
paramField = New ParameterField
paramField.ParameterFieldName = "Periode"
rangeVal.StartValue = BeginPeriode
rangeVal.EndValue = EindPeriode
paramField.CurrentValues.Add(rangeVal)
paramFields.Add(paramField)
crViewer.ParameterFieldInfo = paramFields
myReport.SetParameterValue("Periode", rangeVal)
myReport.SetParameterValue("FiliaalKeuze", discreteVal)
crViewer.ReportSource = myReport
As you can see I use myReport.SetParameterValue to feed the pdf.
It goes wrong with the discrete value. It only sees the second value I
entered and not the first.
How can I get this going?
Kind regards,
Alison
.
- Follow-Ups:
- Re: How is it possible ...
- From: Alison Givens
- Re: How is it possible ...
- References:
- How is it possible ...
- From: Alison Givens
- How is it possible ...
- Prev by Date: Re: Transparent Label
- Next by Date: Re: emulate tab key
- Previous by thread: How is it possible ...
- Next by thread: Re: How is it possible ...
- Index(es):