Need Help With A Report!

Nav_Vision_UserNav_Vision_User Member Posts: 36
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.

Comments

  • Sonja37Sonja37 Member Posts: 9
    Hello

    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. :wink:

    Have you ever had a training for programming reports? It would help you to create reports for the future.

    Kind regards
    Sonja
  • Nav_Vision_UserNav_Vision_User Member Posts: 36
    Hi, Thank you for your response, I have had some training on this, I have also done the calculation before but unfortunately have forgotten how to do this and have misplaced my training notes, the report I need is completed however I need to do these calculations, however thank you for your quick response and recommendations.
  • kash387kash387 Member Posts: 111
    upto what I get you is you can do the calculation of final cost by placing footer section or you need to do coding....

    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.?????
    Thanks,

    Kashyap
  • Nav_Vision_UserNav_Vision_User Member Posts: 36
    Hi Kash, Thanks for your reply. The report is for a Product BOM which will show the final costing for a product. There is a report in Navision which is called "Quantity of Explosion of BOM" which is have modified and brought in "unit cost" now all I need to do is multiply the unit cost with quantity, which will give me a overall cost of the particular product and then to finally do a calculation which will give final cost of that product. Hope you understand this.
  • kash387kash387 Member Posts: 111
    Hi,
    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.
    Thanks,

    Kashyap
  • Nav_Vision_UserNav_Vision_User Member Posts: 36
    Hi Kash, thanks for getting back to me, I really do appreciate your help. I understand it needs to be done by code, unfortunately imp not so familiar with coding in Navision. on "AfterGetRecord I'm getting "

    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
  • Nav_Vision_UserNav_Vision_User Member Posts: 36
    Kash, thank you for all your help, I figured it out and its working like a charm, thank you. The only thing I now need help with is adding the total at the end, you said you use the footer, but what is the function I need to use? (To get the total) Thanks again. If anyone else has any ideas please let me know.

    Regards

    Reece
  • kash387kash387 Member Posts: 111
    Hi..,
    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.....
    Thanks,

    Kashyap
  • Nav_Vision_UserNav_Vision_User Member Posts: 36
    Kash, Thanks so much for your time and patience with me, I have looked everywhere for CAL Global, but unfortunately i can’t find where to put the code you gave me, can you please be a bit specific, sorry to sound like a dumb ass!
  • kash387kash387 Member Posts: 111
    Hey buddy, are you playing with me or what???
    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....
    Thanks,

    Kashyap
  • matttraxmatttrax Member Posts: 2,309
    He was about as specific as you can get.

    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 :D 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.
  • Nav_Vision_UserNav_Vision_User Member Posts: 36
    Hey Kash, sorry about that man I was having a mental relapse :) I get what you said and I am nearly complete, the only part I don’t get is when u said Ucost (dimension 25) do you mean the length must be 25? If so how do I get 25 into the Colum cuz I can’t type anything in there.
  • kash387kash387 Member Posts: 111
    hey man.... its not lengh....
    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????
    Thanks,

    Kashyap
  • Nav_Vision_UserNav_Vision_User Member Posts: 36
    Hi Kash, I done exactly as you stated, unfortunately when I run the report I’m getting two errors 1st its asking me to put a END statement into the code once I do this it then gives me another error message telling me to add ':' which I do but it keeps asking for it.

    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.
  • kash387kash387 Member Posts: 111
    no need to put end.... just place ';' at the end of line

    Ucost[l]:=CompItem."Unit Cost"; //<-- Here u need to put semicolon

    okay.....
    Thanks,

    Kashyap
  • Nav_Vision_UserNav_Vision_User Member Posts: 36
    Hi Kash, Just like to say big thanks for all your help, and persisting with me, it works brilliantly and just how I wanted. Thank you once again! :)
Sign In or Register to comment.