cancel
Showing results for 
Search instead for 
Did you mean: 

report sometimes looses information

Former Member
0 Kudos

hello community,

i've a project in visual basic .NET 2008 where i use crystal reports 2008 .NET. so i build a form where i placed a CrystalReportViewer Object from CrystalDecisions.Windows.Forms. I declare a ReportDocument and add 2 reports as a resource. the reports are two variants of a letter with 2 dynamic parameters. an id and a version param which should be set with vb to the report before assigning the ReportDocument object to the ReportViewer. The Reports use this params to select data in the first level. in second level there are some subreports. they need the same params which they get over an association in the report.

on my development machine everything works fine. but on some machines at customers office when the letter was generated and displayed, some text blocks will not being shown. if you reopen the form the blocks are there. next time they're not. on other machines the reportviewing works correct all time.

here is some code how i do this:

Public Sub v_viewSub()

Dim crReport As CrystalDecisions.CrystalReports.Engine.ReportDocument

If nl.nlTyp = nl.tbsDef.bsTypFS Then

crReport = New rptVorlageFS

ElseIf nl.nlTyp = nl.tbsDef.bsTypGS Then

crReport = New rptVorlageGS

End If

crReport.DataSourceConnections.Item(0).SetConnection(oDatenbank.dbPfad, "", "Admin", "")

crReport.SetParameterValue("nlID", nl.nlID)

crReport.SetParameterValue("nlVersion", nl.nlVersion)

Me.crReportViewer.ReuseParameterValuesOnRefresh = True

Me.crReportViewer.ReportSource = Nothing

Me.crReportViewer.ReportSource = crReport

Me.crReportViewer.Show()

End Sub

this is the compressed code. in the application i handle the loading of the ReportDocument object over a backgroundworker because the first time u load the object takes much time. i disabled the data caching in the report in cr 2008 env.

could someone explain why there are such problems? has someone the same problem and could give me a workaround or a hint what to do on this?

b.k.

Edited by: Bastian Kraus on Jul 15, 2010 11:42 AM

Edited by: Bastian Kraus on Jul 15, 2010 11:42 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

update:

i found a function in the report.vb file.

<Browsable(false), _

DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)> _

Public Overridable Property IsCacheable() As Boolean Implements CrystalDecisions.ReportSource.ICachedReport.IsCacheable

Get

Return True

End Get

Set

'

End Set

End Property

do i deactivate the cache by setting the Return to False? or is this just relevant for asp pages and not for desktop applications?

my regards,

b.k.

Edited by: Bastian Kraus on Jul 19, 2010 2:18 PM

Edited by: Bastian Kraus on Jul 19, 2010 2:18 PM

Answers (2)

Answers (2)

Former Member
0 Kudos

upgraded to sp3, recoded the print form, fixed some problems with upcoming parameter popup but the report is still not showing actual data. just after klicking the refresh button about 5 - 10 times. is there no way to reduce this cache timeout like in the ICachedReport just for desktop applications?

former_member183750
Active Contributor
0 Kudos

This does not make any sense. Try to simplify it to three lines of code:

crReport.Load(myreport_path)

crReport.DataSourceConnections.Item(0).SetConnection(oDatenbank.dbPfad, "", "Admin", "")

CrystalReportsViewer1.ReportSource = crReport

Let the viewer prompt for the parameters. What happens now. If this does not provide any clues I'd suggest creating a [phone case|http://store.businessobjects.com/store/bobjamer/en_US/pd/productID.98078100] since like I said; does not make any sense.

Ludek

Former Member
0 Kudos

just got another project with the same caching problem. i've to reload the report 5 times before an data update takes effekt. i found out that alerting a messagebox right before setting the datasource to the reportdocument object takes some unknown effect to the caching mechanism and shows actual data. -> MsgBox("Dokument wurde erstellt!")

    Private Sub _v_showReport(ByVal sender As Object, _
                            ByVal ev As System.ComponentModel.RunWorkerCompletedEventArgs) _
                            Handles _o_bgWorker.RunWorkerCompleted
        If ev.Cancelled = False Then
            Dim _h_result As New Hashtable
            _h_result = CType(ev.Result, Hashtable)

            If Not (_h_result Is Nothing) Then
                _o_report = _h_result.Item("report")
                Me.pgbImportStatus.Value = 80

                Dim _h_params As Hashtable
                _h_params = _h_result.Item("params")
                If _h_params.Count > 0 Then
                    Dim _o_enum As IDictionaryEnumerator = _h_params.GetEnumerator()
                    While _o_enum.MoveNext
                        _o_report.SetParameterValue(_o_enum.Key, _o_enum.Value)
                    End While
                End If

                Me.pgbImportStatus.Value = 100
                MsgBox("Dokument wurde erstellt!")
                _o_report.DataSourceConnections.Item(0).SetConnection(o_dbHandler.dbPfad, "", "Admin", "")

                Me.crReportViewer.DataBindings.Clear()
                Me.crReportViewer.Refresh()
                Me.crReportViewer.ReportSource = Nothing
                Me.crReportViewer.ReportSource = _o_report
                Me.crReportViewer.ReuseParameterValuesOnRefresh = True

                Me.crReportViewer.Show()

                grpImportStatus.Visible = False

                Me.Text = "Report Ausgabe"
            End If
        Else
            MsgBox("Druckausgabe abgebrochen!")
            Me.Close()
        End If
    End Sub

that's the class of the printing form. thats the same form and code i'm using in the previous named project. why the backgroundworker? because i want to show this progressbar because the first time the viewer gets loaded "hangs" the application up and you have to wait till the viewer is loaded.

does someone know why i have this behaviour?

b.k.