How could I get Drill Down Parameter from server side code?

Stimulsoft Ultimate discussion
Post Reply
170229845
Posts: 7
Joined: Fri Mar 15, 2019 6:37 am

How could I get Drill Down Parameter from server side code?

Post by 170229845 »

I try to use the code :

StiRequestParams requestParams = StiNetCoreViewer.GetRequestParams(this); To get my report Drill Down Parameters.

But seems not work.

How could I get my Drill down parameter from the code?
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: How could I get Drill Down Parameter from server side code?

Post by Lech Kulikowski »

Hello,

We couldn't reproduce the issue on our samples.

Could you explain your issue in more details or send us a sample which reproduces the issue for analysis.

Thank you.
Attachments
photo_2019-05-31_09-45-28.jpg
photo_2019-05-31_09-45-28.jpg (29.92 KiB) Viewed 3791 times
170229845
Posts: 7
Joined: Fri Mar 15, 2019 6:37 am

Re: How could I get Drill Down Parameter from server side code?

Post by 170229845 »

Lech Kulikowski wrote: Fri May 31, 2019 6:46 am Hello,

We couldn't reproduce the issue on our samples.

Could you explain your issue in more details or send us a sample which reproduces the issue for analysis.

Thank you.
Hello

my question is :

I have pass a parameter from page1 to page2,
1.png
1.png (27.21 KiB) Viewed 3789 times
and I want to get this parameter data from code.

How to do it?
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: How could I get Drill Down Parameter from server side code?

Post by Lech Kulikowski »

Hello,

The viewer does not provide parameters values as is, it sends only page ID and reports component. Please try to use the following code:

Code: Select all

public IActionResult ViewerEvent()
{
    var report = StiNetCoreViewer.GetReportObject(this);
    if (report != null)
    {
        var requestParams = StiNetCoreViewer.GetRequestParams(this);
        var drillDownParams = requestParams.Interaction.DrillDown;
        if (drillDownParams != null && drillDownParams.Count > 0)
        {
            var parameters = (Hashtable)drillDownParams[0];
            int pageIndex = Convert.ToInt32(parameters["PageIndex"]);
            int componentIndex = Convert.ToInt32(parameters["ComponentIndex"]);

            var renderedPage = report.RenderedPages[pageIndex];
            var interactionComp = renderedPage.Components[componentIndex];
            if (interactionComp != null && interactionComp.DrillDownParameters != null)
            {
                var paramValue = interactionComp.DrillDownParameters["Category"];
                // ...
            }
        }
    }

    return StiNetCoreViewer.ViewerEventResult(this);
}
Thank you.
emanuelv
Posts: 20
Joined: Fri Sep 13, 2019 5:46 pm

Re: How could I get Drill Down Parameter from server side code?

Post by emanuelv »

Hello,
I know this thread is a bit old, but I am trying to accomplish the same thing. This solution works for a single level drilldown (Page1 to Page2). But if I want to drill down from Page1 to Page2 to Page3, this solution does not seem to work. It appears that the report's `RenderedPages` collection only contains Page1. So when I try to do the same thing to access the drill down parameters I set up in Page2 on that second drill down, I am unable to because Page2 does not exist in `report.RenderedPages`. So the component index does not match and I get a reference error. Is this same strategy possible with multi-level drilldowns?

Here is some additional info to help troubleshoot. On the second drilldown, the `drillDownParams` now contains two elements. The drilldown params for that first drilldown into Page2 and the second set. You can see that in element 0, the PageGuid is set to the guid of Page2. This is correct since I was drilling down to page 2. However, on the second drilldown, a new set of elements is added in index position 1. The PageGuid is set to the guid of Page3. So this is correct, but the PageIndex is 0. However, you can see in the report.RenderedPages, there is only 1 page... Page1. So that second Page2 was never added to the set of RenderedPages. So now, I cannot access the drilldown parameters in Page2's component because Page2 was not rendered although it was displayed on the front end. I attached a screenshot of the variables.

Thanks!
Attachments
2020-06-24 13_12_33-Window.jpg
2020-06-24 13_12_33-Window.jpg (100.87 KiB) Viewed 3281 times
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: How could I get Drill Down Parameter from server side code?

Post by Lech Kulikowski »

Hello,

There is no access to the second page - because with multi-level detail, all levels are recalculated each time.

Thank you.
emanuelv
Posts: 20
Joined: Fri Sep 13, 2019 5:46 pm

Re: How could I get Drill Down Parameter from server side code?

Post by emanuelv »

Ah I see. Is there another recommended way to do that? We have a report that drills down to a page. And that drills down to another page. However, I need to be able to access the drill down parameters of that second page (just like the first page) from within code because we use those parameters to decide what data to fetch and register in the data sources.

Any help would be appreciated!
Thank you.
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: How could I get Drill Down Parameter from server side code?

Post by Lech Kulikowski »

Hello,

There is no standard way.
As a way, try to use global variables in your code to store parameters.

Thank you.
Post Reply