Thanks for looking!
Nav 4.0 SP3
I have a very basic report that I created to detail the past shipping/invoice history of a customer, sorted by customer, then sales order no. then line items. I wanted to do this filtered on just a specific range of item numbers, so lines that were to GL or a different range were omitted.
This is what my Report Designer looks like:
Customer
__Sales Invoice Header
___Sales Invoice Line
_____ Integer ( Amounts )
And my code for each section looks like this:
( SIL = Sales Invoice Line Temp table )
Customer - OnAfterGetRecord()
TotalAmount := 0;
Sales Invoice Line - OnAfterGetRecord()
SIL.SETRANGE("Document No.","Document No.");
SIL.SETRANGE("Line No.","Line No.");
IF NOT SIL.FINDFIRST THEN
BEGIN
SIL := "Sales Invoice Line";
SIL.INSERT;
END
ELSE
BEGIN
SIL.Amount :=
SIL.Amount + Amount;
SIL.MODIFY;
END;
Amounts - OnPreDataItem()
Amounts.SETRANGE(Number,1,SIL.COUNT);
Amounts - OnAfterGetRecord()
IF Amounts.Number = 1 THEN
SIL.FINDFIRST
ELSE
SIL.NEXT;
TotalAmount := TotalAmount + SIL.Amount;
Since I have to wipe the "TotalAmount" Global each time a new customer is pulled, I'm having a hard time adding up all of the customers totals.
Can someone help so that I'd have a grand total?
Thanks a million..
-Adam
Answers
Two ways to solve this - create a new variable for OverallTotal and add into it when you total TotalAmont or use the currreport.createtotals - this command is very usefull and will maintain total per group and an overall total even if the value is zero'd in the middle. Look at report 105 for a easy example
Hope this helps.
Dynamics Nav Add-ons
http://www.simplydynamics.ie/Addons.html
I'm familiar with the create totals aspect of the program, however I didn't know it would work when calculating variables etc.
Thanks!
-Adam
Customer - OnAfterGetRecord: If you dont´t want to create the key, you´ll have to add the Amounts line by line (if SalesInvoiceLine.find('-') then repeat .. until).
All the other DataItems are not necessary.
Just one simple question though.
How do I remove the tabs from the "report filter" screen? Currently it has all the tabs at the top for the different filtering, but I want to remove a few.
Thanks!
-Adam
Technical Consultant, MS Dynamics NAV
RIS Plus, LLC
I know how to remove the fields that could recieve filters, what I meant to type was that I don't know how to remove the tab altogether, like the "integer" tabs are completely unnecessary, etc.
haha, sorry about that
-adam
RIS Plus, LLC
1 - Check the ReqFilterFields property. If this is already blank: good. If this has any value, remove it.
2 - Set a sort order in the DataItemTableView property
Now you should not have a tab for the dataitem any longer.
RIS Plus, LLC
I'm unfamiliar with the phrase that you so eloquently repeated, "set a sort order." Nothing is glaringly obvious when I view the properties of each table in the field you mentioned, as Integer tables have no viewable capabilities in these realms, but I'd rather avoid the confrontation and frustration and be on my way, report finished and all.
Perhaps I should become a site supporter again.
Thanks,
-Adam
Since you wrote that you are familiar with these properties, I assumed that you would know where to find it. You obviously did not find where you can select the sort order for the Integer dataitem. That comment makes me think that you did not understand my suggestion, dismissed it and you didn't even take the time to look around in there. Let me tell you exactly how to get there.
Open your report in design, put the cursor on the integer dataitem, and open the properties page. Scroll down to the DataItemTableView property and click the ellipsis button (that's the little button with the 3 dots on it, and you can also press Shift+F2), which opens the 'table view' dialog box. In the 'Key' field, click the lookup button (that's the one with the arrow pointing upward), and you will see the Integer Key List, from which you can select the Number field as the key, which sets the sort order of the dataitem to the number field of the virtual Integer table.
I've told you the same thing in three different ways, and you keep telling me that it is not what you need. If this still confuses you, please tell me what it is exactly that you don't understand, and I will try to help you.
RIS Plus, LLC
My coworkers and I got a laugh out of your comical response when you needed to slow it down for me, yet the information you provided did indeed help in finally "finishing" this report. Best of all, everyone at my company is very pleased with the effort, as they found the report to be very useful and extremely beneficial to their daily activities. I couldn't have done it without you! Thanks!
All the best
-Adam
Good to hear you got that to work, well done.
RIS Plus, LLC