Hi, I’m quite new to Navision, however I was wondering if one of the experts can help me. I’m trying to do a report within Navision (Not SQL) which requires me to do a few calculations for example; I want to add a function to the report which multiplies the “unit cost” with “quantity” and to give a final cost at the bottom of the report. Is this possible to do? And if so can someone please explain to me how this will be done. I thank you in advance.
0
Comments
well.... when I understand you right... yes, it is possible to create such a report. To explain how to add a calculation is (mostly) unfortunately not done with a couple of sentences.... have you checked the standard reports in NAV? Sometimes it is better to "borrow" from a standard report except to program something new.
Have you ever had a training for programming reports? It would help you to create reports for the future.
Kind regards
Sonja
bt what exactly you want to do tell me properly.... I mean is it the report for PO/SO/Vendor/Customer or say for Item.?????
Kashyap
I have seen that report.
In the designing mode, you can see there are three dataitems.
The last is Integer, press F9 while you are on that dataitem.
You can see a line written for BOMQty on 'On AfterGetRecord' trigger....
What you need to do is to find the unit cost of all the particular item that is used in the BOM. That you can get from the Item table. Second thing you need to do is to multiply the BOMQty with the cost.
Than use any loop for making total each time for new count.
I hope you get what you want. I have never worked on that report or on BOM bt I think this is what you are looking for.
Kashyap
BOMQty := Quantity[Level] * QtyPerUnitOfMeasure * BomComponent[Level].Quantity;
The "unit cost" that I am using is CompItem."Unit Cost" now if you could be kind enough to tell me where and how I would need to write the code, and how I would need to multiply that BOMQty with CompItem."Unit Cost" That would be fantastic. I look forward to your reply. Thanks
Regards
Reece
I am back...
First Define these variables on C/AL Globals
Ucost Decimal (Dimension 25)
l Integer
TotCost Decimal
j Integer
FinalCost Decimal
See the code I have written here....
On BOMLoop dataitem,
OnPreDataItem trigger
l:=1;
OnAfterGetRecord trigger...
there is a statement: CompItem.GET(BomComponent[Level]."No.");
just writedown below that statement
Ucost[l]:=CompItem."Unit Cost"
l:=l+1;
Then go to last dataitem (integer),
OnPreDataItem trigger
l:=1;
OnAfterGetRecord trigger,
TotCost:=BOMQty*Ucost[l];
FOR j:=l DOWNTO j DO
BEGIN
FinalCost:=TotCost+FinalCost;
END
Finish..... Then on BOMLoop footer print the FinalCost.....
You will get your value buddy.....
Kashyap
what do you mean by saying you didnt find C/AL Globals.....
go in design mode, then press Alt+V and click on C/AL Globals and then do all the needful that is written on previous post....
Kashyap
Globals are under View --> C/AL Globals.
He tells you exactly what data items to use and what triggers to add that code to. You can view the code when you're on the data item with F9 or View --> C/AL Code.
I don't think there's being any more specific Sounds like you need to read the C/AL Help from the NAV Client. And or download the product CD and go through the application designers guide.
My Blog - nav.education
just define that variable as decimal and then press shift+F4 or go in to properties for that variable....
there you will find dimension.... okay????
Kashyap
The error pinpoints the following part of the code.
OnAfterGetRecord trigger...
there is a statement: CompItem.GET(BomComponent[Level]."No.");
just writedown below that statement
Ucost[l]:=CompItem."Unit Cost"
(pin points to here to insert END)
l:=l+1; (pinpoints here to add ':' which i am doing as l':'=l+1;)
Your help is greatly appreciated.
Ucost[l]:=CompItem."Unit Cost"; //<-- Here u need to put semicolon
okay.....
Kashyap