CALCFIELDS on inventory gives different results

Jacob_P
Member Posts: 4
I have a question I hope you can answer, if so you will save my day and weekend.
The problem is I have is that a function in the Item table calculates the Inventory and if I do the same thing with a codeunit, gives a different result(only with some Item posts, not all).
The code in the Item table:
CALCFIELDS(Inventory);
testdump := Inventory;
MESSAGE(FORMAT(testdump));
The code in the Codeunit:
item.CALCFIELDS(item.Inventory);
return := item.Inventory;
IF(ItemCode='GTX280') THEN
MESSAGE(FORMAT(return));
I appreciate any help
The problem is I have is that a function in the Item table calculates the Inventory and if I do the same thing with a codeunit, gives a different result(only with some Item posts, not all).
The code in the Item table:
CALCFIELDS(Inventory);
testdump := Inventory;
MESSAGE(FORMAT(testdump));
The code in the Codeunit:
item.CALCFIELDS(item.Inventory);
return := item.Inventory;
IF(ItemCode='GTX280') THEN
MESSAGE(FORMAT(return));
I appreciate any help
0
Comments
-
ho looks the source before the calcfields in your codeunit?
Mean how looks the filter on Item (maybe a filter is set)?
REgardsDo you make it right, it works too!0 -
thank you for replying. I have a get before. The function get an item code from another function and it handles it in this way. So the get should take care that it is the right record
IF(item.GET(ItemCode)) THEN
BEGIN
item.CALCFIELDS(item.Inventory);
return := item.Inventory;
IF(ItemCode='GTX280') THEN
MESSAGE(FORMAT(return));0 -
Hi Jacob,
If you look at the properties of the inventory field on the item table, you will see that there are filter affecting the calculating the value on the inventory flowfield. Can you check is any of these filters are set before the code you have shown e.g. Global Dimension 1 Filter, Location Filter, etc0 -
I thank you for your help. I found it that there were some locationfilters set, with the GETFILTERS function0
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