SUM Calculations with FILTER NOT showing correctly

earldelrosarioearldelrosario Member Posts: 6
Hi All,

I'm fairly new with NAV Coding. Can you please tell me what I'm doing wrong:

I want to calculate the SUM of quantities in "Item Ledger Entry" filtered by the Users "Shortcut Dimension 1 Code".

In the Item Table Fields are:
- "Global Dimension 1 Filter" (for filtering)
FieldClass = FlowFilter
TableRelation = "Dimension Value".Code WHERE (Global Dimension No.=CONST(1))
- "InvQty" (for getting the sum of quantity)
FieldClass = FlowField
CalcFormula(Sum("Item Ledger Entry".Quantity WHERE (Item No.=FIELD(No.),Global Dimension 1 Code=FIELD(Global Dimension 1 Filter)))

In the List Page I did this
- OnOpenPage
IF UserSetup.GET(USERID) THEN
VALIDATE("Global Dimension 1 Filter",UserSetup."Shortcut Dimension 1 Code");
MESSAGE('%1',"Global Dimension 1 Filter"); -- Just for checking if getting the correct data

What am I doing wrong. I'm getting the total of all quantity and not filtered by "Shortcut Dimension 1 Code"

Thanks.

Best Answer

Answers

  • postsauravpostsaurav Member Posts: 708
    If i am not wrong you have these two as custom fields -
    > User setup - Shortcut Dimension 1 Code).
    > Item - InvQty.
    Try This -
    IF UserSetup.GET(USERID) THEN
    Item.SetFilter("Global Dimension 1 Filter",UserSetup."Shortcut Dimension 1 Code");
    Item.Caclfields( InvQty);
    Let us know how it goes.

    Thanks & Regards,
    Saurav Dhyani

    Do you Know this About NAV?


    Connect - Twitter | Facebook | Google + | YouTube

    Follow - Blog | Facebook Page | Google + Page
  • earldelrosarioearldelrosario Member Posts: 6
    Hi BlackTiger,

    No haven't read any programming guide specific to NAV. I've been searching for books and reading online blogs to learn more about NAV programming.

    Thanks.
Sign In or Register to comment.