Problem with code
mkpjsr
Member Posts: 587
Hi all,
I want to show the current inventory of items on Transfer Order form when the Item No is selected, so I have written the following code under OnValidate trigger of "Item NO" fileld:
globals i have used:
ItemRec->Record->Item
Inventory->Decimal
ItemRec.GET("Item No.");
// ItemRec.SETFILTER(ItemRec."Location Filter",'MAIN STORE');
ItemRec.CALCFIELDS(Inventory);
Inventory:=ItemRec.Inventory;
If the line contains one item then there is no issue but, if i am selecting another item then the value of inventory field is getting updated with the inventory of new item.
should i use array or something else to resolve this issue.
Can anybody suggest me the solution.
I want to show the current inventory of items on Transfer Order form when the Item No is selected, so I have written the following code under OnValidate trigger of "Item NO" fileld:
globals i have used:
ItemRec->Record->Item
Inventory->Decimal
ItemRec.GET("Item No.");
// ItemRec.SETFILTER(ItemRec."Location Filter",'MAIN STORE');
ItemRec.CALCFIELDS(Inventory);
Inventory:=ItemRec.Inventory;
If the line contains one item then there is no issue but, if i am selecting another item then the value of inventory field is getting updated with the inventory of new item.
should i use array or something else to resolve this issue.
Can anybody suggest me the solution.
0
Answers
-
OnValidate of the table field or of the field control in the form?
Maybe you should move your code to the OnAfterGetRecord trigger of the (sub)form."Money is likewise the greatest chance and the greatest scourge of mankind."0 -
einsTeIn.NET wrote:OnValidate of the table field or of the field control in the form?
Maybe you should move your code to the OnAfterGetRecord trigger of the (sub)form.
thanx, its done0 -
einsTeIn.NET wrote:Maybe you should move your code to the OnAfterGetRecord trigger of the (sub)form.
The scene looking like you must have written your code on OnAfterGetRecord trigger because you have used a variable to show inventory. whether it will be better if you add a field in table and write code on validate trigger of item no.0 -
Yes, I think that would be a better solution, but I assumed that mkpjsr doesn't have access to the table design. That's why I said "maybe" and I asked for which OnValidate trigger.vijay_g wrote:whether it will be better if you add a field in table and write code on validate trigger of item no."Money is likewise the greatest chance and the greatest scourge of mankind."0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions