How To Access The Selected DrillDown Parameter For Selected Row - Angular

Stimulsoft Dashboards.WEB discussion
Post Reply
billy.goforth
Posts: 24
Joined: Fri Apr 09, 2021 1:44 pm

How To Access The Selected DrillDown Parameter For Selected Row - Angular

Post by billy.goforth »

I am using the stimulsoft angular viewer.

I have enabled drilldown capability on an StiDataBand. I use this to load a newly ran report on the drillDownPage (In .Net WPF Viewer all works fine).

But in API Controller for angular viewer, I'm not seeing the property for the selected drilldown (yet I am getting it in the WPF Viewer interaction).

HEre's what I have in the API that builds my report (no templates, reports are dynamic and built using c#).

Code: Select all

tableBand.Interaction.DrillDownParameter3 = new StiDrillDownParameter(resultSetMetadata.DrilldownKey);
tableBand.Interaction.DrillDownParameter3.Expression = dt.TableName + "." + resultSetMetadata.DrilldownKey;
In WPF Events, I have access to the DrillDownParameters Dictionary of all the DrillDownParameters assigned by the above code. I can therefore run api requests and build new report and then assign to my declared drillDownPage.

WHERE are the selected DRillDownParameters for the above expression on the angular viewer?
Lech Kulikowski
Posts: 6198
Joined: Tue Mar 20, 2018 5:34 am

Re: How To Access The Selected DrillDown Parameter For Selected Row - Angular

Post by Lech Kulikowski »

Hello,

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

Thank you.
billy.goforth
Posts: 24
Joined: Fri Apr 09, 2021 1:44 pm

Re: How To Access The Selected DrillDown Parameter For Selected Row - Angular

Post by billy.goforth »

The issue i was having was how to capture the selected row drilldown parameter when a user clicks on a table row. There has to be some reference to the selected row's drilldown parameters as defined during the build of the report (ours are built 100% dynamically in C#, no template). I found the below way to do this, perhaps this will help someone else who is having this same issue.

Code: Select all

[HttpPost("Viewer/ViewerInteraction")]
		[ScopeAndPermission(ThisApi.ScopePublic)]
		public IActionResult ViewerInteraction()
		{
			//-- Called on events in Stimulsoft component (paged requests, etc).
			var requestParams = StiAngularViewer.GetRequestParams(this);

			if(requestParams.Action == Stimulsoft.Report.Web.StiAction.Variables)
			{
				requestParams.Interaction.Variables["Variable1"] = "MyValue";
				return StiAngularViewer.InteractionResult(requestParams);
			}
			else if(requestParams.Action == StiAction.DrillDown)
			{
				var report = StiAngularViewer.GetReportObject(this);

				//-- Build Parameter Accessors
				var drillDown = requestParams.Interaction.DrillDown;
				var parameters = (Hashtable)drillDown[0];
				var pageIndex = Convert.ToInt32(parameters["PageIndex"]);
				var componentIndex = Convert.ToInt32(parameters["ComponentIndex"]);
				var renderedPage = report.RenderedPages[pageIndex];
				var interactionComponent = renderedPage.Components[componentIndex];

				var drilldownReport = new StiReport();
				if(interactionComponent != null && interactionComponent.DrillDownParameters != null)
				{
					drilldownReport = this.BuildDrilldownReportAsync(interactionComponent.DrillDownParameters).Result;
				}
				//-- Assign new report as drilldown
				report.SubReports.Add(drilldownReport);
				return StiAngularViewer.GetReportResult(this, drilldownReport);
			}
			return StiAngularViewer.InteractionResult(this);
		}
Lech Kulikowski
Posts: 6198
Joined: Tue Mar 20, 2018 5:34 am

Re: How To Access The Selected DrillDown Parameter For Selected Row - Angular

Post by Lech Kulikowski »

Hello,

Thank you for the provided solution.
Post Reply