Telerik
Home / Community / Forums / Telerik Reporting / Adding Percents to Grouped Items in Crosstab

Not answered Adding Percents to Grouped Items in Crosstab

Feed from this thread
  • brian piccolo avatar

    Posted on Jul 7, 2009 (permalink)

    Hello,

    I have created a new report using the CrossTab Wizard in the Q2 release.  It's great!  However, I'd like to now add a column to the report to display a percentage based on subtotals in the crosstab.

    I've tried using the ItemDataBound event of the Detail section, Crosstab and TextBox processing elements using the examples that I've found on this website and forum:

    Forum Post Percent Example
    http://www.telerik.com/community/forums/reporting/telerik-reporting/use-report-footer-fields-in-group-field-calculation.aspx

    Custom Aggregate Function
    http://www.telerik.com/support/kb/reporting/general/implementing-and-using-custom-aggregate-functions.aspx

    Combining Values from Documentation
    http://www.telerik.com/help/reporting/faq-combine-values2.html

    When I try to use the example fromt he documentation, the DataObject.Rawdata property is null so I can't access the DataRowView object in the detail_ItemDataBound event.  I suspect it's because of the way the crosstab control is rendered but I spent several hours yesterday playing around with different combinations in the different event handlers but haven't had much luck.

    Can anyone point me in the right direction?  I can provide code examples if necessary.

    Thanks in advance!
    Brian

    Reply

  • brian piccolo avatar

    Posted on Jul 7, 2009 (permalink)

    Hello, does anyone have any suggestions?  I've tried a few additional approaches including trying to use the Report property of the detail section, text box, or crosstab objects but haven't had any luck.  Any information would be greatly appreciated.

    Reply

  • Telerik Admin admin's avatar

    Posted on Jul 10, 2009 (permalink)

    Hi Brian,

    DataObject.RawData is available for the child items of the respective parent only i.e. report, section, panel, table item. So if you have bound a table item to a datasource, it would be available for the items within that table and there is no way to get to it in the detail or table ItemDataBound event. However if you set DataSource for the report, DataObject.RawData would be available for items in the report sections.

    Greetings,
    Steve
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.

    Reply

  • brian piccolo avatar

    Posted on Jul 10, 2009 (permalink)

    Hi Steve,

    Thanks for the reply.  I've tried adding the datasource to the report itself but when I do, the crosstab report doesn't return any data at all.  The only way I can get data is to add the datasource to the crosstab.  The example provided in my ticket was created usign the crosstab wizard.

    I'm really looking to reproduce the functionality from the Percent example link  - http://www.telerik.com/community/forums/reporting/telerik-reporting/use-report-footer-fields-in-group-field-calculation.aspx - but within the crosstab.  Is this possible?  Seems like I need to get at the report data rather than the raw data from the datasource in order to calculate the percentages.

    Any additional thoughts?

    Thanks
    Brian

    Reply

  • Telerik Admin admin's avatar

    Posted on Jul 10, 2009 (permalink)

    Hello Brian,

    I think I've been misunderstood. The table item can be looked upon as separate "data region" and thus you need to databind it if you would expect it show your data fields. What I was trying to imply is that the DataObject.RawData would be available for the child items only and that is why it is not available in the ItemDataBound event of the table itself.
    Seems like I need to get at the report data rather than the raw data from the datasource in order to calculate the percentages.
    For the scenario you're aiming at, it would be best to add a new column to your datasource, where to calculate the percentage and only display it in the table. It can be achieved with reporting expressions as well, but this would require good understanding of the table/crosstab API, as you would need to cycle through its cells and locate the desired item.
    While doing this at database level would only require you to add =First(Fields.MyPercentDataField) to the textbox expression.

    All the best,
    Steve
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.

    Reply

Related resourses for "Adding Percents to Grouped Items in Crosstab"

Features  |  Documentation  |  Demos  |  Telerik TV  |  Knowledge Base  |  Code Library  |  Step-by-step Tutorial  |  Blogs  |  Whitepaper  ]

Powered by Sitefinity ASP.NET CMS

Contact Us | Site Feedback | Terms of Use | Privacy Policy
Copyright © 2002-2010 Telerik. All rights reserved.