Solved

Array list for a report

Posted on 2007-03-28
4
332 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 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now