desperately trying to get parameters into reports

Stimulsoft Dashboards.WEB discussion
Post Reply
TestBoy
Posts: 46
Joined: Tue Oct 23, 2018 8:14 pm

desperately trying to get parameters into reports

Post by TestBoy »

I don't know how to articulate this so bear with me.

I have a page with something as simple as a textbox.
I need to somehow get that value into my controller.. or somewhere?

I have these actions:

Code: Select all

Actions =
    {
        GetReport = "GetReport",
        ViewerEvent = "ViewerEvent",
        Interaction = "ViewerInteraction"
        
    }
None of these have any variables from my page. If I try to include a model .. well, my model is null when one of the above methods is fired.
So it does not pass the model back even tho the model was returned to the page and the forms are filled with data from that model.
It seems to me that the only way to make this work is to have a page where the user can enter their data and then post that to a second page?
There has to be a better solution than something hacky like that.
I can do that and it works but that's just crap.

All I have been able to do so far is get it to refresh:
jsNetCoreViewer.postAction('Refresh');

That's it.
How do I get new variables into the report on refresh?

I amn lost... this web stuff isn't my thing so I am really out of my element.
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: desperately trying to get parameters into reports

Post by Lech Kulikowski »

Hello,

Sorry, maybe we did not exactly understand your question. Could you explain your task in more details?

Thank you.
TestBoy
Posts: 46
Joined: Tue Oct 23, 2018 8:14 pm

Re: desperately trying to get parameters into reports

Post by TestBoy »

Ok, I posted this in the wrong place but I will probably have the same issue with the dashboards to be fair.
Consider the following workspace (attached)

I just altered the index page and controller to add the report.
I also added a simple model.

On the index page there are two textboxes and a button.
Those values are tied to the test model.
When you push the button the values are posted to the controller, values are there... all is well.

But I need those values in GetReport. It fires next.
But of course, it does not pass the model in. I tried that. It's all null.
I need that model.

How do I get it?
Attachments
WebApplication1.zip
(1.72 MiB) Downloaded 213 times
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: desperately trying to get parameters into reports

Post by Lech Kulikowski »

Hello,

We need some time yo investigate the issue.

Thank you.
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: desperately trying to get parameters into reports

Post by Lech Kulikowski »

Hello,

Please set the following option for the viewer:

Code: Select all

Server =
{
    PassFormValues = true
}
In the viewer action, you can get values from the form:

Code: Select all

public IActionResult GetReport()
{
    var formValues = StiNetCoreViewer.GetFormValues(this);

    StiReport report = new StiReport();
    report.Load(StiNetCoreHelper.MapPath(this, "~/Reports/Report.mrt"));
    report.Dictionary.Variables["Variable1"].Value = formValues["foo"];
    report.Dictionary.Variables["Variable2"].Value = formValues["bar"];
    return StiNetCoreViewer.GetReportResult(this, report);
}
Thank you.
Attachments
photo_2019-09-10_10-18-49.jpg
photo_2019-09-10_10-18-49.jpg (48.49 KiB) Viewed 2890 times
Alejandro323
Posts: 5
Joined: Mon Sep 07, 2020 1:09 pm

Re: desperately trying to get parameters into reports

Post by Alejandro323 »

did you resolve that issue?
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: desperately trying to get parameters into reports

Post by Lech Kulikowski »

Hello,

Yes, was provided solution in the last reply.

Thank you.
Post Reply