AggregateDescriptions

4 posts, 0 answers
  1. Rieni De Rijke
    Rieni De Rijke avatar
    170 posts
    Member since:
    Mar 2010

    Posted 09 Sep 2012 Link to this post

    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?
    
    
  2. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 11 Sep 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Ryan
    Ryan avatar
    4 posts
    Member since:
    Jul 2014

    Posted 18 Aug 2014 in reply to Rosen Vladimirov Link to this post

    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
  5. Kalin
    Admin
    Kalin avatar
    1208 posts

    Posted 19 Aug 2014 Link to this post

    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.
     
Back to Top