StrataFrame Forum

Crystal Report Error

http://forum.strataframe.net/Topic22354.aspx

By Raymond Lo - 3/13/2009

Dear Sir,

       I have a report to my application, I make the report reference from StrataFlix, but not work. when the report Viewer display show the error message: "An error occured during local report processing. The report definition for report 'pis.Reports.CustomerListing' has not been specified"

I don't know where coding is wrong. Can you help me solve this problem? 

====ReportEngine==== 

   Private Shared Function GetReportDataSource(ByVal report As PisReports) As IReportDataSource
        '-- Establish Locals
        Dim r As IReportDataSource = Nothing

        Select Case report
            Case PisReports.CustomerListing

                r = New Reports.CustomerListing.CustomerListingDataSource()

            Case PisReports.CustomerProfile
                '            r = New Reports.MovieProfile.MovieProfileDataSource()

            Case PisReports.PeopleProfile
                '           r = New Reports.PeopleProfileReport.PeopleProfileDataSource()
        End Select

        '-- Return the results
        Return r
    End Function

#End Region

#Region " Public Methods "

    ''' <summary>
    ''' Runs the specified report
    ''' </summary>
    ''' <param name="report"></param>
    ''' <remarks></remarks>
    Public Shared Sub RunReport(ByVal report As PisReports)
        '-- Establish Locals
        Dim f As New ReportViewer()
        Dim rpt As IReportDataSource

        '-- Get the data source for the report
        rpt = GetReportDataSource(report)

        '-- Populate the data source
        If rpt.PopulateDataSource() Then

            '-- Run the report

            f.RunReport(rpt.LocalReport)
            f.ShowDialog()
        End If

    End Sub

=========populate DataSource===

        Public Overrides Function PopulateDataSource() As Boolean
            '-- Establish Locals
            Dim r As Boolean = True
            Dim CustomerBrw As New pis.BrowseDialogs.CustomerBrowseDialog
            ' Dim CustomerBrw As New StrataFlix.UI.BrowseDialogs.MoviesBrowseDialog()

            '-- Set the BO to populate
            CustomerBrw.BusinessObjectToPopulate = Me.DataSource.SourceBO

            '-- For this instance, force the focus to the results after the query so that the
            '   OK button will come on if there are any results in the list
            CustomerBrw.SetFocusToResultsAfterSearch = True

            '-- Change the header title
            '     movieBrw.HeaderTitle = "Movie Listing"

            '-- In this case we are just using the Movie Browse to populate the source BO.  But
            '   a custom dialog could just as easily be shown instead.

            If CustomerBrw.ShowDialog() = Windows.Forms.DialogResult.OK Then
                '-- Force the sort to title name
                Me.DataSource.SourceBO.Sort = "custno"

                '-- Set the report information
                Me.LocalReport.DisplayName = "Customer Listing"
                Me.LocalReport.ReportEmbeddedResource = "Pis.Reports.CustomerListing"

                '-- Create the LocalReport data sources
                Me.LocalReport.DataSources.Add(New ReportDataSource("Source", Me.DataSource))
                '-- Indicate that the data source was populated
                Return True
            Else
                '-- There is no reason to continue since the browse was cancelled
                Return False
            End If
        End Function

By Trent L. Taylor - 3/13/2009

Well, this really isn't the right information.  First of all, what was the stack trace?  Secondly, at what point does the error occur?  Next, can you populate and reference the data source outside of Crystal Reports?
By Raymond Lo - 3/13/2009

Hi Trent L. Taylor,

      I checked and make sure the data is Populated, I using  Me.LocalReport.ReportEmbeddedResource = "Pis.CustomerListing.rdlc" to assign the report but when the ReportViewer popup , still show "Pis.CustomerListing.rdlc" has not been specified. Is there anywhere need to specify the report ? (please tell me where is specify the report coding in StrataFlix or show me how to step by step make the report.

Thank you for your help.

By Trent L. Taylor - 3/14/2009

You will wnt to look at the ReportDataSource within the StrataFlix application.  If you look at the RDLC reports used within StrataFlix, the logic will be the very same in regards to the Custom BBS, report data sources, etc.  Crystal reports is not generally a reporting engine that we recommend for  number of reasons.  But regardless, this is not your issue.  Regardless of the reporting engine that you choose, you need to create an engine that will be used at run-time to prepare the data and sync it up with the actual report.

We have an entire section in our training class that we go over this type of thing.  This is why we created the StrataFlix sample to show how to implement a reporting engine within an application versus a step-by-step.  This way you have the source code, step through it, etc.