Page 1 of 1

StiViewerMvc parameters

Posted: Thu Oct 22, 2015 9:21 am
by pritaeas
HI. Just need a push in the right direction. If I make a report with a parameters panel for MVC, does (re)setting these call the controller's ReportSnapshot method again? If so, how can I access the user values in my controller method to return the right data?

For a completer picture, assume a report defaulting to a date range of a month, but having the ability to change those at will.

Re: StiViewerMvc parameters

Posted: Thu Oct 22, 2015 1:02 pm
by HighAley
Hello.

You could use next code in Interaction action to get values of parameters.

Code: Select all

public ActionResult InteractionEvent()
        {
            StiJavascriptParameters parameters = StiMvcViewer.GetViewerParameters();
            var value = ((System.Collections.Hashtable)parameters.Parameters["variables"])["Variable1"];
            return StiMvcViewer.InteractionResult();        
        }
Thank you.

Re: StiViewerMvc parameters

Posted: Thu Oct 22, 2015 2:21 pm
by pritaeas
OK, that's how I get the parameters, but how am I passing back the new/changed dataset?

All the examples I can find pass in all data, then filter. I want to pass in only the relevant data, and reload when the filters change.

Re: StiViewerMvc parameters

Posted: Fri Oct 23, 2015 1:12 pm
by HighAley
Hello.

Here is code that change the value of variable when the Request from user parameters are passed.
You could register new data the same way here.

Code: Select all

        public ActionResult InteractionEvent()
        {
            var par = StiMvcViewer.GetViewerParameters();
            //par.Action
            StiReport report = StiMvcViewer.GetReportObject();
            report["Variable1"] = "жопа";
            report.Render();
            return StiMvcViewer.InteractionResult(report);
        }
Thank you.