CALCFIELDS on inventory gives different results

Jacob_PJacob_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

Comments

  • garakgarak Member Posts: 3,263
    edited 2008-11-14
    ho looks the source before the calcfields in your codeunit?
    Mean how looks the filter on Item (maybe a filter is set)?

    REgards
    Do you make it right, it works too!
  • Jacob_PJacob_P Member Posts: 4
    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));
  • DaveTDaveT Member Posts: 1,039
    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, etc
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • Jacob_PJacob_P Member Posts: 4
    I thank you for your help. I found it that there were some locationfilters set, with the GETFILTERS function
Sign In or Register to comment.