Page 1 of 1

Sending some more information as part of Save action

Posted: Fri Aug 29, 2014 5:36 am
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.

Re: Sending some more information as part of Save action

Posted: Fri Aug 29, 2014 5:51 am
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.

Re: Sending some more information as part of Save action

Posted: Fri Aug 29, 2014 1:35 pm
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.

Re: Sending some more information as part of Save action

Posted: Sat Aug 30, 2014 3:48 pm
by bobsov
Yes I have source code license. It will be good to know about report meta tags implementation.

Thank you.

Re: Sending some more information as part of Save action

Posted: Mon Sep 01, 2014 6:59 am
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.

Re: Sending some more information as part of Save action

Posted: Mon Sep 01, 2014 3:54 pm
by bobsov
This is indeed helpful. Thank you so much.

Re: Sending some more information as part of Save action

Posted: Tue Sep 02, 2014 4:09 am
by Andrew
Hello,

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