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. Image for the cookie policy date

Amount not shown in PivotGrid

Hello, I try to use PivotGridControl and bind ItemSource with DataTable. All fields can display except "Amount".
My DataTable result looks like this:

Sect Year Month Quarter Amount
SA-MSD2014 11 Q1 21375
SA-MSD 2015 2 Q2 1668675
SA-MSD 2015 3 Q2 673000
SA-MSD2015 4 Q3 0
SA-MSD2015 5 Q3 16400000
SA-MSD 2015 6 Q3 37000
SA-MSD 2015 8 Q4 2390000
SA-MSD 2015 9 Q4 187362.5


And Code to initialize grid control looks like this:
public void InitializeGridControl()
{
this.pgcResult.ItemSource = dt;
this.pgcResult.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Metro;
//this.MetroColor = System.Drawing.Color.Transparent;
// Adding Pivot Rows to Grid
this.pgcResult.PivotRows.Add(new PivotItem { FieldMappingName = "Sect", TotalHeader = "Total" });
this.pgcResult.PivotRows.Add(new PivotItem { FieldMappingName = "Year", TotalHeader = "Total" });
//Adding Pivot Columns to Grid
this.pgcResult.PivotColumns.Add(new PivotItem { FieldMappingName = "Quarter", TotalHeader = "Total" });
this.pgcResult.PivotColumns.Add(new PivotItem { FieldMappingName = "Month", TotalHeader = "Total" });
//Adding PivotCalculations to Grid
this.pgcResult.PivotCalculations.Add(new PivotComputationInfo { FieldName = "Amount", Format = "#,##0", SummaryType = SummaryType.DoubleTotalSum });
}





And this is result:
pivotgrid
Please give any suggestion to resolve a problem. Thanks.

5 Replies

SA Solai A L Syncfusion Team September 30, 2015 12:41 PM UTC

Hi Chairat,

Thank you for using Syncfusion Products. 

We had analyzed your query and the image provided is not visible. So, please share the image via attachment, zipped/Rar format. We have prepared a similar sample using the data table. Please refer to the sample and update whether it is the same problem.

Sample: 
http://www.syncfusion.com/downloads/support/forum/120634/ze/CS-1380245317.


Thanks & Regards,
AL.Solai.



CY CHAIRAT YANWITTAYAKOOL October 1, 2015 02:32 AM UTC

I attach image again.
Attachment: PivotGrid_cef1cf57.zip


SA Solai A L Syncfusion Team October 6, 2015 11:36 AM UTC

Hi Chairat,

The Pivot Calculations column will be visible based on the property ShowCalculationsAsColumns and it is set to true by default. If the Calculation column is not visible, the data isn’t related properly. Refer to the following sample and image. If such correlation is not correct, then the column would  be missing. So, please change the data accordingly.

Sample location :
C:\Users\<user>\AppData\Local\Syncfusion\EssentialStudio\<version>\Windows\PivotGrid.Windows\Samples\Appearance\Pivot Grid Demo\CS


Thanks & Regards,
AL.Solai.


CY CHAIRAT YANWITTAYAKOOL October 24, 2015 03:15 AM UTC

Hi AL.Solai.,

  Thanks for your reply. Problem has been solve. But I found another problem about loading data again.
When I click button to call InitializeGridControl() at first time, Pivot works fine. But when call it again, It throw exception like this at line:

this.pgcResult.PivotCalculations.Add(new PivotComputationInfo { FieldName = "Amount", Format = "#,###.#0", SummaryType = SummaryType.DoubleTotalSum });

Exception 1

Exception 2

I try to use this code to clear all data before call function but it still same error. 

            this.pgcResult.PivotColumns.Clear();
            this.pgcResult.PivotRows.Clear();
            this.pgcResult.PivotCalculations.Clear();
            this.pgcResult.TableModel.Clear(true);

Do you have any suggestion?

Attachment: Exception_7e10ed22.zip


SA Solai A L Syncfusion Team October 26, 2015 12:05 PM UTC

Hi Chairat,

Thank you for your update.

We created an incident for this query in our DT support for better communication. So, please login our DT support.
Link :
http://www.syncfusion.com/support/directtrac/incidents


Thanks & Regards,
AL.Solai.


Loader.
Live Chat Icon For mobile
Up arrow icon