Dynamic Name Report

Stimulsoft Reports.WEB discussion
Post Reply
Tânia
Posts: 34
Joined: Thu Jun 13, 2013 12:22 pm

Dynamic Name Report

Post by Tânia »

Hi,

Use Asp.NET MVC, and I need to create dynamic reports names, therefore, to call my view the report while the name of this parameter, but just do load the report on the event passed to the "ActionGetReportSnapshot" and it does not have as pass parameters because it is triggered internally, you have a suggestion for me to solve this problem? Something provided by Stimulsoft?

Thanks in advance,
Tânia
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Dynamic Name Report

Post by HighAley »

Hello, Tânia.

You could set report name with next code:

Code: Select all

report.ReportName = "MyDynamicReportName";
Thank you.
Tânia
Posts: 34
Joined: Thu Jun 13, 2013 12:22 pm

Re: Dynamic Name Report

Post by Tânia »

Sorry, but I could not expose my need.
I have my controller, which possess the Actions that need as Index, GetReportSnapshot, ViewerEvent. In Action GetReportSnapshot, I Load the report, but the report name is dynamic, this name is passed to another view, when calling my Action report, this time I have the name of the report, but I can not pass this name to the Action GetReportSnapshot because Stimulsoft that triggers this action. Basically, I need to do the same thing you do here ... http://mobile.stimulsoft.com/
You have the same data, same action, same view, only report calls differently.
I thought of a way to do it, but it would be a 'jerry-rig', I wonder if you have an example of how I could do what I need.

I'm currently testing the Mobile MVC, if you possess such...

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

Re: Dynamic Name Report

Post by HighAley »

Hello.

You could find sample project in the installation folder.

Thank you.
Tânia
Posts: 34
Joined: Thu Jun 13, 2013 12:22 pm

Re: Dynamic Name Report

Post by Tânia »

Sorry, not found in the Samples folder a project that exemplifies what I need. But I could do what I needed.

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

Re: Dynamic Name Report

Post by HighAley »

Hello.

Here is code from our sample project "MvcMobileViewer (Razor)":

Code: Select all

        public ActionResult GetReportSnapshot()
        {
            // Create the report object and load data from xml file
            StiReport report = new StiReport();
            DataSet data = new DataSet("Demo");
            data.ReadXml(Server.MapPath("~/Content/Data/Demo.xml"));

            // Restore the route values collection and get the id value
            RouteValueDictionary routeValues = StiMvcMobileViewer.GetRouteValues(this.HttpContext);
            int id = 1;
            if (routeValues["id"] != null) id = Convert.ToInt32(routeValues["id"]);

            // Load report
            switch (id)
            {
                // Load report snapshot
                case 1:
                    report.LoadDocument(Server.MapPath("~/Content/Reports/SimpleList.mdc"));
                    break;

                // Load report template
                case 2:
                    report.Load(Server.MapPath("~/Content/Reports/TwoSimpleLists.mrt"));
                    report.RegData(data);
                    break;

                // Load compiled report class
                case 3:
                    report = new StiMasterDetail();
                    report.RegData(data);
                    break;
            }

            return StiMvcMobileViewer.GetReportSnapshotResult(HttpContext, report);
        }
Thank you.
Post Reply