Setup Designer with Data

Stimulsoft Reports.WEB discussion
Post Reply
ksimmons
Posts: 9
Joined: Thu Jun 27, 2013 2:52 pm

Setup Designer with Data

Post by ksimmons »

I have an MVC project that we would like to add reporting to. I want to allow users to create new mrt files within the designer and just pass the data source to it. How can I open the designer without pre-defining a report? The code below opens the designer but does not have the data source populated and just keeps throwing "Error: Internal Server Error" messages:

View:

Code: Select all

@Html.Stimulsoft().StiMvcMobileDesigner(
    "StimulsoftDesigner1",
    new StiMvcMobileDesignerOptions
    {
        
        ActionGetReportTemplate = "GetReportTemplate",
        ActionGetReportSnapshot = "GetReportSnapshot",
        ActionSaveReportTemplate = "SaveReportTemplate"
    })
Controller:

Code: Select all

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

            DataTable dt = (DataTable)Session["ReportSource"];
            report.RegData(dt);

            return StiMvcMobileDesigner.GetReportTemplateResult(HttpContext, report);
        }

        public ActionResult GetReportSnapshot()
        {
            StiReport report = StiMvcMobileDesigner.GetReportObject(HttpContext);

            // Register data, if necessary
            DataTable dt = (DataTable)Session["ReportSource"];
            report.RegData(dt);

            // Return the report snapshot result to the client
            return StiMvcMobileDesigner.GetReportSnapshotResult(HttpContext, report);
        }

        public ActionResult SaveReportTemplate()
        {
            StiReport report = StiMvcMobileDesigner.GetReportObject(HttpContext);
            report.Save(@"D:\" + report.ReportName + ".mrt");

            return StiMvcMobileDesigner.SaveReportTemplateResult(HttpContext);
        }
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Setup Designer with Data

Post by HighAley »

Hello.

Please, call next method after registering data:

Code: Select all

report.Dictionary.Synchronize();
As about error, when do you get Internal Server Error? Could you send us a sample project?

Thank you.
ksimmons
Posts: 9
Joined: Thu Jun 27, 2013 2:52 pm

Re: Setup Designer with Data

Post by ksimmons »

Attached is the sample project. The call to Synchronize works, but it throws an error whenever I try to add something to the report (i.e. a data band, report title, etc).
Attachments
SampleMVC.7z
(12.44 MiB) Downloaded 147 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Setup Designer with Data

Post by HighAley »

Hello.

You missed one necessary action. You should add it to your project.

Code: Select all

        public ActionResult DesignerEvent()
        {
            return StiMvcMobileDesigner.DesignerEventResult(HttpContext);
        }
Thank you.
ksimmons
Posts: 9
Joined: Thu Jun 27, 2013 2:52 pm

Re: Setup Designer with Data

Post by ksimmons »

Perfect! Thanks! I totally missed the need for it in the documentation.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Setup Designer with Data

Post by HighAley »

Hello.

We will create a greater emphasis on this in our documentation.

Thank you.
Post Reply