When is BusinessObjectValue initialized

Stimulsoft Reports.NET discussion
Post Reply
ChristianMyksvoll
Posts: 18
Joined: Thu Sep 22, 2011 8:42 am
Location: Norway

When is BusinessObjectValue initialized

Post by ChristianMyksvoll »

I am currently using forms to capture input parameters within several reports I have made in a project at work. In addition I get the data for the report through a ReportService class in a self-made assembly. The service is registered as a BusinessObject. This is working great and I can in this way encapsulate the SQL within my assembly. Here is a simplified version of the input form Ok button click event:

Code: Select all

var service = this.Dictionary.BusinessObjects["MyReportService"].BusinessObjectValue as ReportService;
service.MyMethod(param1, param2, ...)
Because of some new requirements, I now need to be able to run these reports in the web viewer. I am able to transform most of the input parameters to variables (using 'Request from User'), but I am struggling with accessing the ReportService.

I have tried accessing the ReportService in the report constructor and the StiReport.BeginRenderEvent with no luck. It does not seem to be initialized at those points. It is however accessible from the input form Ok button click event.

I have attached a complete Visual Studio example of the issue (references to Stimulsoft-assemblies may need to be changed). I am using Stimulsoft Reports.Ultimate 2014.1.
Attachments
reportdemo.zip
Demo VS project with example report
(9.69 KiB) Downloaded 195 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: When is BusinessObjectValue initialized

Post by HighAley »

Hello.

Sorry, for the delay with answer.
We need some additional time for analyzing.

Thank you.
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Re: When is BusinessObjectValue initialized

Post by Ivan »

Hello.

Please try to use the following code in the BeginRender event of the report:

Code: Select all

object service = null;
foreach (var bo in this.BusinessObjectsStore)
{
    if (bo.Name == "MyReportService") service = bo.BusinessObjectValue;
}
if (service != null)
{
    var typed = service as ReportService;
    typed.Test();
}
Thank you.
Post Reply