Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Data Connectivity
Message Icon Topic: Crystal versus VB. Help please! Post Reply Post New Topic
Author Message
conspiratus
Newbie
Newbie


Joined: 06 Oct 2011
Location: Russian Federation
Online Status: Offline
Posts: 1
Quote conspiratus Replybullet Topic: Crystal versus VB. Help please!
    Posted: 06 Oct 2011 at 11:31pm
Dear colleagues, i faced with problem.
May be someone can helped me.
This line in code bellow
"crSubReport.Database.Tables(0).SetDataSource(dsReport) "
is reset my "main" object, i mean all values for parameters after this line equals null. 
WHY!!!???
Thank you in advance.
my scype: conspiratus1
Dim main As New Object

        Select Case _reportType
            Case 0
                main = New CRCheckConsistency2
                posCollection.Add("CPOSWITHSALES")
                posCollection.Add("CPOSWITHOUTSALES")
                posCollection.Add("CPOSMODIF")
                posCollection.Add("CPOSABNORMALTREND")
                posCollection.Add("EANWITHSALES")
                posCollection.Add("EANWITHOUTSALES")
                posCollection.Add("EANABNORMALTREND")
                posCollection.Add("EANMODIF")
                posCollection.Add("CPOSUNKNOWN")
                posCollection.Add("EANUNKNOWN")
                posCollection.Add("CPOSWITHOUTADDR")
                posCollection.Add("EANWITHOUTDESC")
                posCollection.Add("CPOSEXCLUDED")
                posCollection.Add("EANEXCLUDED")

            Case 1
                main = New CRCheckRelevance2
                posCollection.Add("ACTPOSWITHOUTSALES")
                posCollection.Add("SUPPPOSWITHSALES")
                posCollection.Add("INACBRDWITHSALES")
                posCollection.Add("ACTBRDWITHSALES")
                posCollection.Add("ACTBRDWITHOUTSALES")
                posCollection.Add("POSPERCHAIN")
                posCollection.Add("POSPERCHANNEL")
                posCollection.Add("BRANDPERPRICECAT")
                posCollection.Add("BRANDPERTASTE")
                posCollection.Add("BRANDPERBLEND")
                posCollection.Add("BRANDPERSIZE")
                posCollection.Add("BRANDPERMANUFACT")
                posCollection.Add("OTPPERMANUFACT")
                posCollection.Add("TOTALPERMANUFACT")
                posCollection.Add("WRLCHECK")
        End Select

        Dim _checkResultDetailDatatable As DataTable = dsReport.Tables("CHECK_RESULT_DETAIL")
        Dim nbr As Integer = checkResultDetailAdapter.SelectBySubEntityByMonth(_checkResultDetailDatatable, _subentityId, _monthId, typeResultIds)
        dsReport.AcceptChanges()

        Dim crSubReport As ReportDocument
        For Each typeCode In posCollection
            crSubReport = New ReportDocument

            typeResult = typeResultAdapter.SelectByCodeGetBo(typeCode)

            crSubReport = main.OpenSubreport(typeCode)

            crSubReport.Database.Tables(0).SetDataSource(dsReport) 
            main.SetParameterValue("typeResultId", typeResult.TYP_RSLT_ID, typeCode) 
            main.SetParameterValue("period", VISTA.Main.boSubentityProcess.month, typeCode)
            main.SetParameterValue("subentity", VISTA.Main.boSubentityProcess.subEntity, typeCode)

            Select Case _reportType
                Case 0
                    main.SetParameterValue("title", "CONSISTENCY CHECK RESULTS", typeCode)
                Case 1
                    main.SetParameterValue("title", "RELEVANCE CHECK RESULTS", typeCode)
            End Select

            Dim sberp As ReportDocument = New ReportDocument()

        Next

        For Each typeCode In posCollection
            dv = New DataView(dsReport.Tables("CHECK_RESULT_DETAIL"))
            typeResult = typeResultAdapter.SelectByCodeGetBo(typeCode)
            dv.RowFilter = "TYP_RSLT_ID = " + typeResult.TYP_RSLT_ID.ToString()
            If dv.Count = 0 Then
                main.SetParameterValue(typeCode + "View", True)
            Else
                main.SetParameterValue(typeCode + "View", False)
            End If
        Next

        CrystalReportViewer1.ReportSource = main
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.