?
Solved

Array list for a report

Posted on 2007-03-28
4
Medium Priority
?
391 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
  • 3
4 Comments
 
LVL 101

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 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 18809720
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 18927892
Glad i could help

mlmcc
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

850 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