Still can't figure out totals..

yuppicideyuppicide Member Posts: 410
edited 2010-02-03 in Navision Attain
Navision 3.10..

Still can't figure out how to get totals to work properly.

I'm trying to make a new report, which is a combination of two reports relating to inventory.

On one report I want to use "Qty. on Sales Order" and QtyAvailable. on another report I want to use "Sales (Qty.)".

I've taken the first report and saved it as a new one.. deleted everything I did not want to show. Now I wanted to add in that "Sales (Qty.)" field.

If run the report I've taken that from, it shows the following:



I've circled in red the figures I want to take and put on the other report.

Here's how it shows up instead:



I've circled in red how they come out with the 0's.

What I did was add =<"Sales (Qty.)" to the Item, Body sections on my report, as well as Item, Footer section. I then added =<Item."Sales (Qty.)" to the Item Variant, Body.

When I tried to add the "Sales (Qty.)" and tried to compile it gave me an error, so I added that to C/AL Globals, yet on the original report I took it from doesn't have it in C/AL Globals. As of writing this I tested and went into my newly created report and deleted it from Globals and it compiled fine. Weird.

Comments

  • kinekine Member Posts: 12,562
    Do not forget to add the field into TotalFields property of the dataitem to automatially calc the totals...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • yuppicideyuppicide Member Posts: 410
    Yes, sorry, I have the following in <Item> Code:
    CurrReport.CREATETOTALS("Sales (Qty.)",TotalValue,"Quantity on Hand", "Qty. on Purch. Order","Qty. on Sales Order",
                   QtyAvailable );
    

    It's the first one on the list.

    In <Item Variant> I put the following code:
    CurrReport.CREATETOTALS(Item."Sales (Qty.)" );
    
  • SavatageSavatage Member Posts: 7,142
    Are your using CALCFIELDS somewhere for these flowfields?

    Without defining calcfields for those fields they will appear as zero

    Since you have a report that already works - review all the c/al code on dataitems &
    view sections see the code there too and dataitem properties.

    ex/

    OnPreDataItem()
    CurrReport.CREATETOTALS(Item."Sales (Qty.)",Item."Sales ($)");
    OnAfterGetRecord()
    CALCFIELDS("Sales (Qty.)","Sales ($)");
  • yuppicideyuppicide Member Posts: 410
    Yes. I will look through the code. Looking there I've got it to print 18 all the way down so far.. will keep messing around with it.
    Savatage wrote:
    Are your using CALCFIELDS somewhere for these flowfields?

    Without defining calcfields for those fields they will appear as zero

    Since you have a report that already works - review all the c/al code on dataitems &
    view sections see the code there too and dataitem properties.

    ex/

    OnPreDataItem()
    CurrReport.CREATETOTALS(Item."Sales (Qty.)",Item."Sales ($)");
    OnAfterGetRecord()
    CALCFIELDS("Sales (Qty.)","Sales ($)");
  • yuppicideyuppicide Member Posts: 410
    I still can't get this to work. Might abandon this project (and anything with a total in the future lol).

    After much fooling around and deleting my newly modified reports to start fresh, this is where I am at.

    I have dual monitor setup, so in one last attempt I've started over once again. I have my newly modified report on one monitor, and the report I want Sales (Qty.) from on the other monitor. This way I can compare code and information easily.

    It correctly shows everything except for the item from the other report.

    For the Sales (Qty.) it shows the following on my report:
    ITEM NO.  VARIANT CODE SALES (QTY.)
    3140-0440              18
    
              BLACKL       18
              BLACKM       18
              BLACKS       18
              BLACKXL      18
              LILACL       18
              LILACM       18
              LILACS       18
              LILACXL      18
              TAUPEL       18
              TAUPEM       18
              TAUPES       18
              TAUPEXL      18
    

    The quantity is doing 18 all the way down no matter what I've tried. It should be show 0,0,0,0 for Black, 4,4,2,2 for Lilac, and 2,2,1,1 for Taupe which equals 18 total.
  • SavatageSavatage Member Posts: 7,142
    obviously it's not resetting by variant. you're getting the full total. Are you pulling the full total from the item card or item ledger entry?
Sign In or Register to comment.