jsctechy
asked on
Array list for a report
hi there,
I have a sub that it needs to take a list of parameters and pass it to the a report.
my problems occurs when i have to pass the parameters and get the values out from the array is there a way you experts can help me?
here is my code:
Public Shared Sub GenerateReport(ByVal strRptName As String, ByVal ParamArray param() As String)
Dim crReportDocument As ReportDocument
Dim pFieldDefs As ParameterFieldDefinitions
Dim mypFieldDef As ParameterFieldDefinition
Dim pVal As ParameterValues = New ParameterValues
Dim pDiscreteVal As ParameterDiscreteValue = New ParameterDiscreteValue
Try
crReportDocument = New ReportDocument
crReportDocument.Load("C:\ Reports\" & strRptName)
crReportDocument.SetDataba seLogon("p ark", "park")
pFieldDefs = crReportDocument.DataDefin ition.Para meterField s
Dim objectlist As String
For Each objectlist In param
pDiscreteVal.Value = objectlist.Substring(0)
pVal.Add(pDiscreteVal)
mypFieldDef = pFieldDefs(objectlist)
mypFieldDef.ApplyCurrentVa lues(pVal)
Next
' crReportDocument.ExportToD isk(Export FormatType .RichText, strExportPath)
'crReportDocument.PrintToP rinter(1, True, 1, 1)
Catch ex As Exception
Windows.Forms.MessageBox.S how(ex.Mes sage)
End Try
End Sub
the only thing i know is that this part is not working and it is setup wrong:
For Each objectlist In param
pDiscreteVal.Value = objectlist.Substring(0)
pVal.Add(pDiscreteVal)
mypFieldDef = pFieldDefs(objectlist)
mypFieldDef.ApplyCurrentVa lues(pVal)
Next
how can i change in order to pass my values to the report?
I have a sub that it needs to take a list of parameters and pass it to the a report.
my problems occurs when i have to pass the parameters and get the values out from the array is there a way you experts can help me?
here is my code:
Public Shared Sub GenerateReport(ByVal strRptName As String, ByVal ParamArray param() As String)
Dim crReportDocument As ReportDocument
Dim pFieldDefs As ParameterFieldDefinitions
Dim mypFieldDef As ParameterFieldDefinition
Dim pVal As ParameterValues = New ParameterValues
Dim pDiscreteVal As ParameterDiscreteValue = New ParameterDiscreteValue
Try
crReportDocument = New ReportDocument
crReportDocument.Load("C:\
crReportDocument.SetDataba
pFieldDefs = crReportDocument.DataDefin
Dim objectlist As String
For Each objectlist In param
pDiscreteVal.Value = objectlist.Substring(0)
pVal.Add(pDiscreteVal)
mypFieldDef = pFieldDefs(objectlist)
mypFieldDef.ApplyCurrentVa
Next
' crReportDocument.ExportToD
'crReportDocument.PrintToP
Catch ex As Exception
Windows.Forms.MessageBox.S
End Try
End Sub
the only thing i know is that this part is not working and it is setup wrong:
For Each objectlist In param
pDiscreteVal.Value = objectlist.Substring(0)
pVal.Add(pDiscreteVal)
mypFieldDef = pFieldDefs(objectlist)
mypFieldDef.ApplyCurrentVa
Next
how can i change in order to pass my values to the report?
ASKER
when execute objectlist.Substring(0) gives me the first value to be past
the line before: For Each objectlist In param hold every value of my paremeters list but from here onwards it getting stuck!!! how can i pass the value of each pair to pDiscreteVal and mypFieldDef?
i hope that helps
the line before: For Each objectlist In param hold every value of my paremeters list but from here onwards it getting stuck!!! how can i pass the value of each pair to pDiscreteVal and mypFieldDef?
i hope that helps
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad i could help
mlmcc
mlmcc
mlmcc