Solved

Array list for a report

Posted on 2007-03-28
4
369 Views
Last Modified: 2008-02-01
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.SetDatabaseLogon("park", "park")
            pFieldDefs = crReportDocument.DataDefinition.ParameterFields

            Dim objectlist As String
            For Each objectlist In param

                pDiscreteVal.Value = objectlist.Substring(0)
                pVal.Add(pDiscreteVal)
                mypFieldDef = pFieldDefs(objectlist)
                mypFieldDef.ApplyCurrentValues(pVal)

            Next
            ' crReportDocument.ExportToDisk(ExportFormatType.RichText, strExportPath)
            'crReportDocument.PrintToPrinter(1, True, 1, 1)

        Catch ex As Exception
            Windows.Forms.MessageBox.Show(ex.Message)
        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.ApplyCurrentValues(pVal)

            Next
how can i change in order to pass my values to the report?
0
Comment
Question by:jsctechy
[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
  • 3
4 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 18809136
What does this return  objectlist.Substring(0)

mlmcc


0
 
LVL 1

Author Comment

by:jsctechy
ID: 18809388
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
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 18809720
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 18927892
Glad i could help

mlmcc
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C# Infragistics UltraGrid - Export to Excel 2 185
Crystal Reports - Trim Data 7 75
Multiple Parameters in Crystal 11 85
Crystal reports login after closing form 3 35
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

749 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