Data for business object not displayed in preview

Stimulsoft Reports.WEB discussion
Post Reply
adinac
Posts: 16
Joined: Mon Apr 22, 2013 11:59 am

Data for business object not displayed in preview

Post by adinac »

Hello,

I am trying to create a report using business objects fetched via Entity Framework. I am able to see the business objects when designing the report, but when I am trying to preview the report, the report is empty, even though there exists data in database.
Am I missing something?

This is my controller:

Code: Select all

public ActionResult ExtendedReportDesigner() {
            return View();
        }

        public ActionResult GetReportTemplate() {
            StiReport report = new StiReport();

            report.Load(Server.MapPath("~/Content/Reports/Templates/BusinessObjectReport.mrt"));

            EFContext ctx = new EFContext();
            IQueryable<Group> groups = ctx.Groups.Where(t => t.GroupID < 10);
            
            // Register Business Objects for Customers in the report
            report.RegBusinessObject("CustomEF","groups", groups);

            report.Dictionary.Synchronize();
            return StiMvcDesigner.GetReportTemplateResult(report);
        }

        public ActionResult DataProcessing() {
            return StiMvcDesigner.DataProcessingResult(this.Request);
        }

        public ActionResult GetReportSnapshot() {
            return StiMvcDesigner.GetReportSnapshotResult(this.Request);
        }
        
        public FileResult ExportReport() {
            StiReport report = StiMvcDesigner.GetReportObject(this.Request);

            return StiMvcDesignerHelper.ExportReportResult(report, this.Request);
        }
...
The view contains this:

Code: Select all

@{
    ViewBag.Title = "ReportDesigner";
}
<h2>ExtendedReportDesigner</h2>
@using Stimulsoft.Report.Mvc;
@Html.Stimulsoft().StiMvcDesigner(new StiMvcDesignerOptions() {
 ActionGetReportTemplate = "GetReportTemplate",
 ActionDataProcessing = "DataProcessing",
 ActionGetReportSnapshot = "GetReportSnapshot",
 ActionExportReport = "ExportReport",
 Width = 1000,
 Height = 800
 })
I am using the following assemblies:

Code: Select all

<add assembly="Stimulsoft.Base, Version=2013.1.1600.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a"/>
<add assembly="Stimulsoft.Design, Version=2013.1.1600.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a"/>
<add assembly="Stimulsoft.Database, Version=2013.1.1600.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a"/>
<add assembly="Stimulsoft.Report, Version=2013.1.1600.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a"/>
<add assembly="Stimulsoft.Report.Design, Version=2013.1.1600.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a"/>
<add assembly="Stimulsoft.Report.Design.WebViewer, Version=2013.1.1600.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a"/>
<add assembly="Stimulsoft.Report.Helper, Version=2013.1.1600.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a"/>
<add assembly="Stimulsoft.Report.Mvc, Version=2013.1.1600.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a"/>
Thanks,

Adina
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Data for business object not displayed in preview

Post by HighAley »

Hello.

Please, register you data in the GetReportSnapshot() action.

Code: Select all

public ActionResult GetReportSnapshot()
        {
            StiReport report = StiMvcDesigner.GetReportObject(this.Request);
            
            // Register the report data
            report.RegBusinessObject(...);

            return StiMvcDesigner.GetReportSnapshotResult(this.Request, report);
        }
Thank you.
Post Reply