Options

SUM up of Amount per group

chadchad Member Posts: 25
Hi Guys!

Anyone can help me to sum up the amount per group in my report? like e.g in SQL

select productpricegroupid,sum(amount) from mw_price_discount
group by productpricegroupid

Comments

  • Options
    sendohsendoh Member Posts: 207
    Welcome to mibuso..:D

    there are couple of ways to do that in NAV but it depends on the requirements though.

    - >group your report and put the variable Amount on the group footer use the createtotals function.

    - > Create a function that return the sum of the amount.
    Function GetSumperProductID(pID : Code[10]) : Decimal
    
    YourTable.Setrange(yourTable.productpriceID,pID);
    if yourtable.findset then repeat
     
     vLocVariable += yourTable.Amount;
    
    until yourtable.next = 0;
    
    Exit(vLocVariable);
    
    .

    3. do the search, there are many threads here like on your problem..
    Sendoh
    be smart before being a clever.
  • Options
    chadchad Member Posts: 25
    Thanks sendoh! :)

    I Created a function to sum up the amount thanks to you. thanks for helping to solve my problem.. :D
Sign In or Register to comment.