Agreggate Expression / Summary Rows

6 posts, 0 answers
  1. Javier
    Javier avatar
    11 posts
    Member since:
    May 2014

    Posted 07 Jul Link to this post

    I have the next problem:

     

    I have a radgridview with data, but i need sum rows of the same column and i use the next code: (vb.net)

     

     Dim summaryItem As New GridViewSummaryItem()
            summaryItem.Name = "column6"
            summaryItem.AggregateExpression = "(Sum(column6))"
            Dim summaryRowItem As New GridViewSummaryRowItem()
            summaryRowItem.Add(summaryItem)
            Me.RadGridView1.SummaryRowsTop.Add(summaryRowItem)

     

    but i dont know in what event is correctly put it.

     

    I put it in a function but the SummaryRowsTop is repeated as many times as entry records. 

    i need only one SummaryRowsTop 

     

  2. Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 08 Jul Link to this post

    Hi Javier,

    Thank you for writing.

    You can add your code to the form's constructor, or you can use the form's Load event.

    Let me know if I can assist you further.

    Regards,
    Dimitar
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Javier
    Javier avatar
    11 posts
    Member since:
    May 2014

    Posted 08 Jul in reply to Dimitar Link to this post

    is perfect. tanks
  5. Javier
    Javier avatar
    11 posts
    Member since:
    May 2014

    Posted 08 Jul in reply to Dimitar Link to this post

    But i need      
  6. Javier
    Javier avatar
    11 posts
    Member since:
    May 2014

    Posted 08 Jul in reply to Dimitar Link to this post

    But i need get value of sum in a variable and do calculations.

     

    I declare a variable Double and  i assigned value of summaryItem. But not is correct. i need know how to assign the value of sum  to variable

     

    Thanks

     

  7. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    710 posts

    Posted 11 Jul Link to this post

    Hello Javier,

    Thank you for writing back.

    If I understand correctly you would like to get the calculated value of the summary item and later use it according to your business logic.

    The value of the summary item is dynamically calculated depending on your rows. In order to achieve your task, you would need to handle the GroupSummaryEvaluate event of the grid and check for the Value argument:
    double value;
    private void radGridView1_GroupSummaryEvaluate(object sender, GroupSummaryEvaluationEventArgs e)
    {
        value = (double)e.Value;
    }

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
Back to Top
UI for WinForms is Visual Studio 2017 Ready