Page 1 of 1

When is BusinessObjectValue initialized

Posted: Tue Jul 29, 2014 8:39 am
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.

Re: When is BusinessObjectValue initialized

Posted: Wed Jul 30, 2014 1:31 pm
by HighAley
Hello.

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

Thank you.

Re: When is BusinessObjectValue initialized

Posted: Thu Jul 31, 2014 11:43 am
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.