SUM Calculations with FILTER NOT showing correctly

earldelrosario
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.
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.
0
Best Answer
-
I've resolved the issue. Here is the code I use.
UserSetup.GET(USERID);
SETFILTER("Global Dimension 1 Filter",UserSetup."Global Dimension 1 Code");
5
Answers
-
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 + Page0 -
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.0 -
I've resolved the issue. Here is the code I use.
UserSetup.GET(USERID);
SETFILTER("Global Dimension 1 Filter",UserSetup."Global Dimension 1 Code");
5
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions