)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Syncfusion Feedback

How to filter PivotGrid with 'from - to' dates?

Platform: jQuery |
Control: ejPivotGrid |
Published Date: June 24, 2019 |
Last Revised Date: June 24, 2019

This KB illustrates that how to filter PivotGrid with 'from - to' dates.

Solution:

You can filter the PivotGrid with "from - to" dates using the following OLAP Report with respective to C# and VB code snippets.

C#

OlapReport olapReport = new OlapReport();
olapReport.Name = "Customer Report";
olapReport.CurrentCubeName = "Adventure Works";
DimensionElement dimensionElementColumn = new DimensionElement();
//Specifying the Name for the Dimension Element
dimensionElementColumn.Name = "Customer";
//Specifying the Hierarchy Name
dimensionElementColumn.HierarchyName = "Customer Geography";
dimensionElementColumn.AddLevel("Customer Geography", "Country");
olapReport.SeriesElements.Add(dimensionElementColumn);
MeasureElements measureElementColumn = new MeasureElements();
measureElementColumn.Elements.Add(new MeasureElement { Name = "Internet Sales Amount" });
olapReport.CategoricalElements.Add(measureElementColumn);
DimensionElement dimensionElementRow = new DimensionElement();
//Specifying the Dimension Name
dimensionElementRow.Name = "Date";
dimensionElementRow.HierarchyName = "Date";
dimensionElementRow.AddLevel("Date", "Date");
for (int i = 0; i <= 10; i++)
{
    dimensionElementRow.Hierarchy.LevelElements["Date"].Add("July " + i + ", 2001");             dimensionElementRow.Hierarchy.LevelElements["Date"].MemberElements[i].ShowChildMembers = true;
}
dimensionElementRow.Hierarchy.LevelElements["Date"].IncludeAvailableMembers = true;
olapReport.CategoricalElements.Add(dimensionElementRow);

VB

Dim olapReport As OlapReport = New OlapReport()
olapReport.Name = "Customer Report"
olapReport.CurrentCubeName = "Adventure Works"
Dim dimensionElementColumn As DimensionElement = New DimensionElement()
'Specifying the Name for the Dimension Element
dimensionElementColumn.Name = "Customer"
'Specifying the Hierarchy Name
dimensionElementColumn.HierarchyName = "Customer Geography"
dimensionElementColumn.AddLevel("Customer Geography", "Country")
olapReport.SeriesElements.Add(dimensionElementColumn)
Dim measureElementColumn As MeasureElements = New MeasureElements()
'TODO: INSTANT VB TODO TASK: Assignments within expressions are not supported in VB.NET
'ORIGINAL LINE: measureElementColumn.Elements.Add(New MeasureElement { Name = "Internet Sales Amount" });
measureElementColumn.Elements.Add(New MeasureElement With {.Name = "Internet Sales Amount"})
olapReport.CategoricalElements.Add(measureElementColumn)
Dim dimensionElementRow As DimensionElement = New DimensionElement()
'Specifying the Dimension Name
dimensionElementRow.Name = "Date"
dimensionElementRow.HierarchyName = "Date"
dimensionElementRow.AddLevel("Date", "Date")
For i As Integer = 0 To 10
 dimensionElementRow.Hierarchy.LevelElements("Date").Add("July " & i & ", 2001")    dimensionElementRow.Hierarchy.LevelElements("Date").MemberElements(i).ShowChildMembers = True
Next i
dimensionElementRow.Hierarchy.LevelElements("Date").IncludeAvailableMembers = True
olapReport.CategoricalElements.Add(dimensionElementRow)

 

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon