Articles in this section
Category / Section

How to provide support for a dynamic filtering in OlapGrid Control

1 min read

The Dynamic filtering feature has been supported in OlapGrid Control. This can be achieved by giving the corresponding Level name in the OlapReport at runtime.

Please refer the below code snippet to achieve.

 

C#

 

 
this.olapGrid.OlapDataManager.SetCurrentReport(this.DynamicReport(productName));
 
/// <summary>
/// Here the "productName" is the corresponding level name.
/// </summary>
/// <returns>Returns the olap report.</returns>
        private OlapReport DynamicReport(string productName)
        {
            OlapReport olapReport = new OlapReport();
 
            olapReport.Name = "DynamicFilterSample";
            olapReport.CurrentCubeName = "Adventure Works";
 
            DimensionElement dimensionColumn = new DimensionElement();
            dimensionColumn.Name = "Product";
            dimensionColumn.AddLevel("Product Categories", "Category");
 
            if (productName != "All")
            {
                dimensionColumn.Hierarchy.LevelElements["Category"].IncludeAvailableMembers = true;
                dimensionColumn.Hierarchy.LevelElements["Category"].Add(productName);
            }
 
            MeasureElements meansureElements = new MeasureElements();
            meansureElements.Elements.Add(new MeasureElement() { Name = "Reseller Order Quantity"} );
 
            DimensionElement dimensionRow = new DimensionElement();
            dimensionRow.Name = "Date";
            dimensionRow.AddLevel("Fiscal", "Fiscal Year");
 
            olapReport.CategoricalElements.Add(dimensionColumn);
            olapReport.CategoricalElements.Add(meansureElements);
            olapReport.SeriesElements.Add(dimensionRow);
 
            return olapReport;
        }

 

                             

Figure: OlapGrid with filtered report

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied