Sending some more information as part of Save action

Stimulsoft Reports.WEB discussion
Post Reply
bobsov
Posts: 115
Joined: Sun Jan 27, 2013 12:10 am

Sending some more information as part of Save action

Post by bobsov »

I am calling my custom javascript function when "Save" button is clicked.

I basically present user with modal dialog box to collect more information about report in report designer. And once that is done, I pass it along "saveReport" action.

However, I sending custom information too but I don't see that in server side. What is the way to make this happen?

Here is my code:

Code: Select all


          jsStiMobileDesigner1.SendCommandSaveReport = function () {
                  var self = this;
                  window.parent.darro.reportUI.saveReport(function (templateDetails) {
                      self.options.reportIsModified = false;
                      self.options.report.reportName = templateDetails.reportName;
                      var params = {};
                      params.command = "SaveReport";
                      params.reportName = templateDetails.reportName;
                      params.reportObject = window.btoa(templateDetails); //this is report details that I collected in modal dialog
                      self.AddCommandToStack(params);
                  });
          }

In above code, I don't see reportObject or don't know how to retrieve this information on server side save report method.
bobsov
Posts: 115
Joined: Sun Jan 27, 2013 12:10 am

Re: Sending some more information as part of Save action

Post by bobsov »

I actually have a work around by concatenating reportName and templateDetails and then separating them out in the server side. This works good for now. However, it would be a good idea to have a way of providing mechanism to carry additional data to the server side.
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: Sending some more information as part of Save action

Post by Vladimir »

Hello,

On the server side command is processed in the following way:

Code: Select all

            #region Save Report
            if (command == "SaveReport")
            {
                this.Report.ReportName = ((string)param["reportName"] != "") ? (string)param["reportName"] : "Report";
                InvokeSaveReport(this.Report);
            }
            #endregion
The report has a collection this.Report.MetaTags in which you can pass your own parameters.
If you license with source code, we can help you implement parameters passing.

Otherwise, use Report.ReportName is also a good solution.

Thank you.
bobsov
Posts: 115
Joined: Sun Jan 27, 2013 12:10 am

Re: Sending some more information as part of Save action

Post by bobsov »

Yes I have source code license. It will be good to know about report meta tags implementation.

Thank you.
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: Sending some more information as part of Save action

Post by Vladimir »

Hello,

Please try this code:

Code: Select all

            #region Save Report
            if (command == "SaveReport")
            {
                this.Report.ReportName = ((string)param["reportName"] != "") ? (string)param["reportName"] : "Report";
                this.Report.MetaTags.Add("ParamName", ((string)param["reportObject"] != "") ? (string)param["reportObject"] : "DefaultValue");
                InvokeSaveReport(this.Report);
            }
            #endregion
In the SaveReport event:

Code: Select all

            ...
            ...
            StiMetaTag metaTag = e.Report.MetaTags["ParamName"];
            e.Report.MetaTags.Remove(metaTag);
            string reportObject = metaTag.Tag;
            ...
Thank you.
bobsov
Posts: 115
Joined: Sun Jan 27, 2013 12:10 am

Re: Sending some more information as part of Save action

Post by bobsov »

This is indeed helpful. Thank you so much.
Andrew
Posts: 4107
Joined: Fri Jun 09, 2006 3:58 am

Re: Sending some more information as part of Save action

Post by Andrew »

Hello,

Have a nice day and do not hesitate to contact us if you have any questions.
Post Reply