Simple PivotGrid where cells show record count

4 posts, 0 answers
  1. Ray
    Ray avatar
    3 posts
    Member since:
    Sep 2014

    Posted 03 Aug 2015 Link to this post

    Hi,

    Telerik UI for ASP.NET AJAX 2015.2.623

    IE10

    Visual Studion 2013

     

     I am new to the PivotGrid and can't seem to figure out this simple thing.  My SQLDataSource returns a list of valves.  2 of the columns are "Valve Size" and "Valve Type".  I have a sinple PivotGrid with a row field of "Valve Size" and a column field of "Valve Type":

        <telerik:RadPivotGrid ID="RadPivotGrid1" runat="server" DataSourceID="sds_ValvesBuiltByDay">
            <Fields>
                <telerik:PivotGridColumnField DataField="Valve Type"></telerik:PivotGridColumnField>
                <telerik:PivotGridRowField DataField="Valve Size"></telerik:PivotGridRowField>
            </Fields>
        </telerik:RadPivotGrid>

    When the page loads, there are rows for each size returned and columns for tech type but the individual cells in the grid are empty.

    (See attached screenshot.  The RadGrid below the PivotGrid displays the same data from the same SQL data source)

    I want each cell to show the count of records for that size and type combination.

    This is probably very simple but I have not found a way to do it.

    Please tell me what I am doing wrong. 

     

     

  2. Eyup
    Admin
    Eyup avatar
    3007 posts

    Posted 06 Aug 2015 Link to this post

    Hello Ray,

    You should add a PivotGridAggregateField to complete the picture. I believe the following post will prove very helpful if you are getting started with the pivot grid:
    http://www.telerik.com/blogs/aspnet-pivot-table-made-easy

    Looking forward to your reply.

    Regards,
    Eyup
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ray
    Ray avatar
    3 posts
    Member since:
    Sep 2014

    Posted 13 Aug 2015 in reply to Eyup Link to this post

    Hi Eyup,

    Thanks for the reply!  I added the aggregate field as you said:

        <telerik:RadPivotGrid ID="RadPivotGrid1" runat="server" DataSourceID="sds_ValvesBuiltByDay" OnCellDataBound="RadPivotGrid1_CellDataBound" Width="800px">
            <Fields>
                <telerik:PivotGridColumnField DataField="Valve Type"></telerik:PivotGridColumnField>
                <telerik:PivotGridRowField DataField="Valve Size"></telerik:PivotGridRowField>
                <telerik:PivotGridAggregateField DataField="Count" DataFormatString="{0:G}"></telerik:PivotGridAggregateField>
            </Fields>
        </telerik:RadPivotGrid>

    But the numbers still don't show up.  In the article you posted, I don't see any additional steps that I missed.  What did I do wrong?

    Please see the attached screenshot...

    Just to make sure that I have described what I'm trying to do:

    The aggregate numbers that I'm trying to display in each cell is the number of valves that are of that valve type (the column) and that valve size (the row).

    Thanks,

     Ray

  5. Eyup
    Admin
    Eyup avatar
    3007 posts

    Posted 18 Aug 2015 Link to this post

    Hello Ray,

    The DataField property should be set to some actual Field from your database. The property that is missing is Aggregate:
    <telerik:PivotGridAggregateField DataField="ProductionOrder" Aggregate="Count">

    That should do the trick. Please make the suggested modification and let me know about the result.

    Regards,
    Eyup
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top