Quantity for items per location not updated.

liizzliizz Member Posts: 125
Hello all,

I have added a field Inventory on the Purchase Line of my Purchase Order which check the Quantity for items per location defined.

I have added a Flowfield on the field Inventory on the table: Sum("Item Ledger Entry".Quantity WHERE (Item No.=FIELD(No.),Location Code=FIELD(Location Code)))..

For e.g: I have chosen Item A and Location Code Green which returns a Quantity of 2 in my Inventory field..
Now, I have change Location Code to White which has a zero quantity but it is giving 2 as quantity.
It is not being updated accordingly. I have to click on the Sales Header part for it to update.

How can I refresh the Quantity without clicking on the form?

Also I have used: CurrForm.UPDATECONTROLS on the Location Code- OnValidate

Thanks
Liizz

Comments

  • nvermanverma Member Posts: 396
    Similar issue has been discussed previously. :)

    Please Search the form.
  • DenSterDenSter Member Posts: 8,304
    Add a CALCFIELD command for the inventory field to the OnValidate trigger of the Item number and the Location code fields, in the TABLE NOT THE FORM.

    You need to stop programming forms for data validation. The form triggers are for display purposes only. Data validation should be programmed on the table level.
  • liizzliizz Member Posts: 125
    DenSter wrote:
    You need to stop programming forms for data validation. The form triggers are for display purposes only

    I have not understand your point. Can you please explain me in some details.

    Thanks
    Liizz
  • nvermanverma Member Posts: 396
    You need to stop programming forms for data validation. The form triggers are for display purposes only
    All your data processing/calculations should be done on the table. Forms are just used to display data (Therefore, as a rule of thumb, you should not do any calculations/validation in the form itself)
  • DenSterDenSter Member Posts: 8,304
    liizz wrote:
    Can you please explain me in some details.
    What I think is happening, is that you open the form in design mode, and you program this code into the OnValidate trigger of the field on the Form object. Instead, you need to figure out which table the form is showing, and program the validation logic into the OnValidate trigger of the field in the TABLE object instead.
  • ChinmoyChinmoy Member Posts: 359
    Also, I fail to understand why you need to add the Inventory field in the Purchase Line table? If you need to display the stock balance of an item in combination to it's location, you can calculate the Inventory by taking a record variable for Item and write a code to filter and then issue a CalcFields for Inventory field and get the balance in a variable. Then display the variable in the Purchase Line with a calculated field.

    Chn
  • dansdans Member Posts: 148
    liizz wrote:
    Also I have used: CurrForm.UPDATECONTROLS on the Location Code- OnValidate
    Liizz

    Try using CurrForm.UPDATE
    Microsoft Certified IT Professional for Microsoft Dynamics NAV

    Just a happy frood who knows where his towel is
Sign In or Register to comment.