This is a migrated thread and some comments may be shown as answers.

AggregateDescriptions

3 Answers 166 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Rieni De Rijke
Top achievements
Rank 1
Rieni De Rijke asked on 09 Sep 2012, 10:42 AM
I have an AggregateDescriptions like this

<DataProviders:LocalDataSourceProvider.AggregateDescriptions>
     <Core:PropertyAggregateDescription PropertyName="Prize" CustomName="Count" AggregateFunction="Count" />
     <Core:PropertyAggregateDescription PropertyName="Prize" CustomName="Sum" AggregateFunction="Sum" />
     <Core:PropertyAggregateDescription PropertyName="Prize" CustomName="Max" AggregateFunction="Max" />
     <Core:PropertyAggregateDescription PropertyName="Prize" CustomName="Min" AggregateFunction="Min" />
</DataProviders:LocalDataSourceProvider.AggregateDescriptions>

When using them in the RadPivotFieldList in the 'Value' -cell, they all show up as "Prize".
Is it possible to set a DisplayName or something like that?

And what about formatting money? Is it possible to set the decimals?


3 Answers, 1 is accepted

Sort by
0
Rosen Vladimirov
Telerik team
answered on 11 Sep 2012, 12:22 PM
Hello,

With the current release you are not able to change the property name in the 'Value' cell, but this will be available for our official release. Sorry for the caused inconvenience.
With the CTP release string formatting of the cells is not possible, but if you download one of our latest internal builds you'll be able to use many different string formats (we've added this functionality after the CTP release). Here's a simple example for some of the formats:
LocalDataSourceProvider dataProvider = this.Resources["DataProvider"] as LocalDataSourceProvider;
var desc = dataProvider.AggregateDescriptions[0] as PropertyAggregateDescription;
 
//different string formats (choose one of the below, remove the others)
desc.StringFormat = ""; // 1234.45 -> 1234.45
desc.StringFormat = "0.000"; // 1234.5678 -> 1234.567
desc.StringFormat = "######"//1234.5678 -> 1235
desc.StringFormat = "$ 0.00"//1234.5678  -> $ 1234.57
desc.StringFormat = "0.0 %"//1234.5678 -> 1234.6 %
desc.StringFormat = "#.# °"; //1234.5678 -> 1234.6 °
desc.StringFormat = "C"//123.456 -> $123.46
 
dataProvider.Refresh();

In fact you'll be able to use most of the string formats described here. Hopefully this helps.

Thank you for choosing RadPivotGrid. Don't hesitate to contact us if you have any suggestions or concerns.

Greetings,
Rosen Vladimirov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Ryan
Top achievements
Rank 1
answered on 18 Aug 2014, 12:43 PM
Hi

I am trying to adjust a formatting before exporting the PivotGrid as suggested above :-

dataProvider.AggregateDescriptions[0].StringFormat = "";
dataProvider.Refresh();
_exportModel = PivotGrid.GenerateExport();

However after changing the format the exportGrid rowCount and colCount =0. Do you know what would cause this ? Else is there a way to export the raw data without the style formatting?

Regards
Ryan
0
Kalin
Telerik team
answered on 19 Aug 2014, 10:52 AM
Hi Ryan,

Thank you for contacting us.

The reason for the explained behavior is that the Pivot hasn't finished refreshing the layout when the GenerateExport() method is called (it needs some more time). The Cells haven't been generated yet and this is why the rowCount and colCount properties are zero. What I can suggest you in order to achieve the desired would be to apply the desired StringFormat right before the SaveFileDialog is shown - this way the string will be applied, the Pivot refreshed and exported correctly.

Hope this will work for you.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
PivotGrid
Asked by
Rieni De Rijke
Top achievements
Rank 1
Answers by
Rosen Vladimirov
Telerik team
Ryan
Top achievements
Rank 1
Kalin
Telerik team
Share this question
or