Report Sharp-Shooter slow preview process


Author
Message
Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi, I know this is a RSS issue, but since many SF developers use RSS I will throw it here anyway Hehe

I have this report which is taking about 15-24 seconds to show in my custom preview form, the preview form will show up blank with the "No Report" label (see image RSS slow loading), then the report will be shown normally.

I know that the data is coming out in less than a second, and the preview form is shown without the report, I have not found a way to display a message to the user letting him/her know that the report is being process.  The code to generate the report is splitted in two classes:

  • ServiceCallRouteDataSource.vb will take care of getting the data and pass it to the report with the following code:

'-- Assign the populated datasource from the Dialog Browser to the Report Manager Object.

ReportManagerObject.DataSources.Item(reportDataSourceName) = Me.DataSource

ReportManagerObject.DataSources.Item(reportApplianceDataSourceName) = Me.DataSource.SourceBO.SC_Appliances

'-- Prepare Report to run

ReportManagerObject.Reports(Me.PerpetuumSoftReportName).Prepare()

  • ReportEngine.vb will actually run the report in the custom preview form like this:

Public Shared Function RunReport(ByVal ReportName As FixTrackReports, _

ByVal ReportManagerObject As PerpetuumSoft.Reporting.Components.ReportManager, _

Optional ByVal tBDStringValue As String = "", _

Optional ByVal tEmployeePK As Int64 = 0) As Boolean

     Dim reportDataSourceObject As IReportDataSource

     '-- Get the data source for the report

     reportDataSourceObject = GetReportDataSource(ReportName)

     '-- Populate the data source

     If reportDataSourceObject.PopulateDataSource(ReportManagerObject, tBDStringValue, tEmployeePK) Then

          Dim f As New ReportViewerDialog()

          '-- Set the Report Viewer source with the Report to be used.

          f.rptViewer.Source = ReportManagerObject.Reports(reportDataSourceObject.PerpetuumSoftReportName)

          f.Title = MicroFour.StrataFrame.Tools.Common.GetEnumDisplayValue(ReportName)

          f.TitleDetailText = ""

          f.ShowDialog()

          Return True

     Else

          MicroFour.StrataFrame.Messaging.MessageForm.ShowMessageByKey("NoDataForReport")

          Return False

     End If

End Function

I have other simple reports which generates faster, so I must be missing something in my whole process.  I will appreciate if somebody can see what am I missing here?

Thanks.

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I haven't had a chance to dissect all of your code here, but there are a couple of things.  If you are calling scalar methods inside of the report, that can slow things down.

Once the RSS engine is handed the data set, it will genereate the report pretty fast.  The slow part always comes when gathering data.  We gather all data prior to caling the report itself.  We have a unique stored procedure for each report that we create that gathers all of the result sets and is optimized to make sure that the loading of the data is fast.  So you need to figure out where your slowness is.

How long is it taking to gather the result sets alone?  This is generally the slow spot.  Are you creating sprocs (genreally a good idea to improve performance)?  Also, are you show a "generating report dialog" while RSS is generating the report?  They have one by default that you can show, but we created our own and you can replace theirs.  They have an implementation called IRenderSite that you can use to create a render status.  When you call the ReportSLot.Prepare method, you can supply class that implements IRenderSite that will show dialog that you create (if that is what you want to do).  This way you can at least see that the rendering is taking place.

Dim rs As New ReportSlot()

rs.Prepare(New MyCustomRenderSite())


Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Trent L. Taylor (10/23/2008)
If you are calling scalar methods inside of the report, that can slow things down.

Well I have a Custom Field Property "CustomerBuildingAddress" used like this:

GetData("ServiceCallProfileDS.CustomerBuildingAddress")+ " Apt " + GetData("ServiceCallProfileDS.Apt_No")

I did a simple test and use the Building Adress FK an ran the report and it took 11 Secs instead of 37 Secs.  Here is the code for the Custom Field Property which I created in the main bo, not the report bo.

Public ReadOnly Property [CustomerBuildingAddress]() As System.String

     Get

          Dim loBusinessObject As New bizBuildings

          loBusinessObject.FillByPrimaryKey(Me.FK_Buildings)

          If loBusinessObject.Count = 1 Then

               Return String.Format("{0}, {1} {2}", loBusinessObject.Street, loBusinessObject.City, loBusinessObject.State)

          Else

               Return String.Empty

          End If

          loBusinessObject.Dispose()

     End Get

End Property

How long is it taking to gather the result sets alone?  This is generally the slow spot.  Are you creating sprocs (genreally a good idea to improve performance)?

Yes, I am using a SP (thanks to Dustin for the clarification in another thread).  The gathering of the data takes milliseconds, so it is pretty quick, I think my problem is with the Custom Field Properties, which are really nice, but guess I will need to use another solution to show those lookup fields descriptions.

Also, are you show a "generating report dialog" while RSS is generating the report?  They have one by default that you can show, but we created our own and you can replace theirs.  They have an implementation called IRenderSite that you can use to create a render status.  When you call the ReportSLot.Prepare method, you can supply class that implements IRenderSite that will show dialog that you create (if that is what you want to do).  This way you can at least see that the rendering is taking place.

Dim rs As New ReportSlot()

rs.Prepare(New MyCustomRenderSite())

I was not aware of such dialog, but yes I need to implement it, without it the user gets the impression that no report is being generated or that the system is freeze.  I am using my own ReportViewerDialog and classes logic used in the StrataFlix, it took me some time to digest, but after that and with yours and Ivan help I was able to get it running with RSS, one thing that I also noticed is that after a report has been rendered and the preview form is closed, when a new report is generated, the image of the previous one will be shown until the new process completes the rendering, is there a way to overcome this?

Edhy Rijo

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (2.7K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Edhy,



When doing look-ups similar this, I don't (very often) get the data within in the property any more. If I do, then I'd typically use a scalar method (not a fill method) instead. Instead, I fill the BO with the lookup values when it is loaded...one trip in that case. Here's sort of how I might do it:



Public Sub FillForReport()

  '-- I'll use SQL statement here, but you could put into sproc to speed up

  ' Because the CustomerBuildingAddress is an agreggate of three fields,

  ' I'd probably do three custom properties in the BO and then aggregate

  ' them when needed (in the report), which provides more flexibility...

  ' easy to put the fields together, harder to rip them apart

  Dim sqlBuilder As New StringBuilder(255)

  With sqlBuilder

    '-- No idea what your SQL would look like...

    '   This just grabs all the fields of the BOs table, plus adds a City column

    '   via a sub query

    .AppendLine("Select *")

    .AppendFormat(" , (Select City From tblBuildingAddress Where BuildingID = {0}) As BuildingCity", Me.FK_Buildings).Append(ControlChars.NewLine)

    .AppendFormat("From {0}", Me.TableName).Append(ControlChars.NewLine)

  End With

  Using cmd As New SqlCommand()

    cmd.CommandText = sqlBuilder.ToString()

    Me.FillDataTable(cmd)

  End Using

End Sub



'-- One of three custom properties (City, Street, State..maybe add in ZIP too).

Public Readonly Property CustomerBuildingCity As String

  Get

    '-- Establish return var, provide empty string as default

    Dim city As String = String.Empty

    

    '-- Check if the city column was included in the data table

    '   If it is, retrieve value, otherwise, the default is returned

    If Me.CurrentDataTable.Columns.Contains("BuildingCity") Then

      city = CType(Me.CurrentRow.Items("BuildingCity"),String)

    End If

  

    '-- Return city

    Return city

  End Get

End Property




Trent has shown an alternative way (which is probably faster) for handling the use of an extra column in the data table to provide the value for a custom property. He uses a method that checks for any extra columns that might be used by custom properties and if the extra column isn't found, just adds it with a default value.



The advantage of doing it this way is you can drastically reduce the number of calls to the db. If your report returns 100 records, using the ExecuteScalar or worse, a Fill method within a customer property would result in (at least) 101 calls to the db (one for the original fill, and one for each time the custom property is called). Compare that with just one call using the above method.



Hope that makes sense. BigGrin
Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Thanks Greg, will start testing with those approaches to see which one give me the best result.

Edhy Rijo

Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Also, are you show a "generating report dialog" while RSS is generating the report?  They have one by default that you can show

Trent, I have been looking in RSS help file and could not find any reference to this dialog or how to make my report use the default one.  RSS site seems to be down, if possible could you tell me how to make use of the default dialog?

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Well, this would be a pretty involved post.  But in short, it is pretty much like I mentioned it.  The IRenderSite implementation just allows you to create a hook and call it when you call the Prepare method on the ReportSlot.  It also has events that you can handle indicating what is going on (i.e. compiling scripts, etc.) so that you can notify your end-user of the status.  I am about to walk into a developer session and will be offline for a while, but if you don't make any progress let me know and I will try and give some more details.
Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Thanks Trent, I will keep digging in the issue.

One more question if you don't mind Smile I have some Custom Field Properties (CFP) in the main BO, which when using the BBS builder, will create a report bo inheriting the main bo and then will have those CFP, is there any way to remove those CFP from the report BO?

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
You could just make the properties on the base BO overridable and then override them in the report BO.  You coudl then apply the <Browsable(False)> and <Bindable(False)> attributes and possibly several others to make them hidden, but I am not sure what this would buy you.  It isn't going to make an performance differences.  And if your end-user cannot modify the report, then this would be a non-issue.
Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Trent L. Taylor (10/24/2008)
but I am not sure what this would buy you.  It isn't going to make an performance differences.

Overridable would work in my case, since I will refactor those Custom Properties but since they are used in some forms I don't want to redo the whole thing, I want to refactor them for the report only, to see if I can gain some speed in the process.

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search