Articles in this section

How to convert the PivotGrid values in date/time format at relational server mode

This KB document explains how to convert the values in date/time format at relational server mode.

Solution:

You can convert the PivotGrid values as date/time by following the below steps.

Step 1:

Render the PivotGrid at relational server mode.

Step 2:

Add the following class in the controller file.

C#

public class DateTimeSummary : SummaryBase
{
 private DateTime mTotalValue;
 
 public override void Combine (object other)
  {
            
  }
 
 public override void CombineSummary(SummaryBase other)
  {
            
  }
 
 public override SummaryBase GetInstance()
  {
     return new DateTimeSummary();
  }
 
 public override object GetResult()
  {
     return mTotalValue; // You can change the value here
  }
 
 public override void Reset()
  {
     mTotalValue = new DateTime();
  }
}

 

Step 3:

Call this method in report, and use SummaryType as custom.

private PivotReport BindDefaultData()
{
PivotReport pivotSetting = new PivotReport();
//…
pivotSetting.PivotCalculations.Add(new PivotComputationInfo { FieldName = "DateValue", FieldHeader = "DateValue", SummaryType = Syncfusion.PivotAnalysis.Base.SummaryType.Custom, Summary = new DateTimeSummary(), Format = "MM/dd/yyyy hh:mm tt" });
return pivotSetting;
}

 

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