Salesline.reset Salesline.setfilter("document no", "No.") If salesline.findset then repeat TempSales.reset TempSales.setrange("item category code", salesline."item category code") If TempSales.findfirst then begin TempSales."amount including vat" += Salesline."amount including vat"; TempSales.modify; End Else begin TempSales:=SalesLine TempSales.insert; End; Until SalesLine.next=0
Answers
Where you want to group it - In report , page or during a custom code?
Thanks & Regards,
Saurav Dhyani
Do you Know this About NAV?
Connect - Twitter | Facebook | Google + | YouTube
Follow - Blog | Facebook Page | Google + Page
I want it to group in page and codeunit
1) create temp record for sales line
2) loop through sales lines you want to group on
3) check if temp sales line exists with same item category code as current sales line
4) if no then add current sales line to temp sales line
5) if yes then add amount incl vat to temp sales line
6) repeat above for each sales line
Now you have a set of temp sales lines - 1 per item category code,
For page, it depends what you need, you could do something similar to the above and then have a page running the temp sale line
I tried it on below code
Salesline.reset
Salesline.setfilter("doc no", "No.")
If salesline.findset then repeat
TempSales.reset
TempSales.setrange("item category code", salesline."item category code")
If TempSales.findset then repeat
TempSales.Amount+=Salesline.Amount
Until TempSales.next=o
Else TempSales:=SalesLine
Until SalesLine.next=o
But tempsales.amount isnt sumamount per item category code. It repeats per line and sumamount is wrong.
Please correct it
Regards,
Undy