Update field for all lines in form

podolly
Member Posts: 84
Dear all,
I am making a customization on form 99000818 (Prod. Order Compoenet). Added 2 fields, LocCode and BinCode, and user can specify a location and bin. When he pushes a "Update" button. All component lines for that production order will be udpated with same location code and bin code, so that warehouse is always putting the picked items to 1 bin.
I have worked a bit on the programming, but can't work it out. I need to move cursor the every line to make it works. Here comes my code.
OnPush() of the UPDATE button
"Location Code" := LocCode;
"Bin Code" := 'B1';
COMMIT;
CurrForm.UPDATE;
How can I modify this to have all lines update at once?
I am making a customization on form 99000818 (Prod. Order Compoenet). Added 2 fields, LocCode and BinCode, and user can specify a location and bin. When he pushes a "Update" button. All component lines for that production order will be udpated with same location code and bin code, so that warehouse is always putting the picked items to 1 bin.
I have worked a bit on the programming, but can't work it out. I need to move cursor the every line to make it works. Here comes my code.
OnPush() of the UPDATE button
"Location Code" := LocCode;
"Bin Code" := 'B1';
COMMIT;
CurrForm.UPDATE;
How can I modify this to have all lines update at once?
0
Comments
-
[0
-
vijay_g wrote:OnPush() of the UPDATE button
"Location Code" := LocCode;
"Bin Code" := 'B1';
COMMIT;
CurrForm.UPDATE;
How can I modify this to have all lines update at once?
hi..
can u tell me on what base you have been changing the value of loccode and B1 for each record.
rest of the all i think you should have to use a function with rec parameter on that same form
and call it from update button push..
Vijay Gupta0 -
Hi, thanks for reply first.
We activated the receipt and pick for the raw material location. To have a full picture on how many items are in-stock and how many items are picked (treat as WIP, but may not consume in real time), we changed the location code and bin code in component lines, so that every time the warehouse pick is from stock to B1. Then items in B1 are the "WIP" and we can have very accurate inventory.
I have also tried rec."Location Code", but it does the same. Originally I wanted to get that set of records and then modify, but it fails to recognize "Prod. Order Component" table, and so I tried this.
Do you have any further idea how to make it? [-o<0 -
I say this with all respect. Based on your code, if you are using a COMMIT, and don't know how the MODIFY or MODIFYALL commands work on records, you should not be changing this code. If you're an end user, talk to your partner. If you're a programmer at a partner, talk to a more senior member of your team. COMMITs can be dangerous; you want to do this mod correctly.0
-
matttrax wrote:I say this with all respect. Based on your code, if you are using a COMMIT, and don't know how the MODIFY or MODIFYALL commands work on records, you should not be changing this code. If you're an end user, talk to your partner. If you're a programmer at a partner, talk to a more senior member of your team. COMMITs can be dangerous; you want to do this mod correctly.
I second this... please, ERP is not a toy... [-o<0 -
podolly wrote:How can I modify this to have all lines update at once?
I do something similar with my Payment journal using a REPEAT & UNTIL. I like to have the Description Line Say (Check Payment "& the date here")
so instead of typing it in everytime I made an Button that runs thru the lines updating the description of each entry.
It looks like this.OnPush() IF CONFIRM("Mass Change All Descriptions?",FALSE) THEN BEGIN //<<Double checking you really want to do this GenJnlLine.RESET; GenJnlLine.COPY(Rec); GenJnlLine.SETRANGE("Bank Payment Type","Bank Payment Type"::"Computer Check"); IF GenJnlLine.FIND('-') THEN //<<Find all the lines that FIT my Setrange REPEAT //<<Start making some changes GenJnlLine.Description := 'Check Payment '+FORMAT(WORKDATE,0,'<Month,2>/<Day,2>/<year4>'); //<<Create New Description GenJnlLine.MODIFY; //<<update the line UNTIL GenJnlLine.NEXT = 0; //<<All done END;
Perhaps you're looking for somthing similar with just changing the location. Just like I used the GenJnlLine - you'll be using Prodction order line (or whatever it's called - we don't use that) Don't forget to validate! This description does not need validation but a location code is different.
VALIDATE("Location Code",LocCode);
I'm assuming these new fields are located on a header where the change is made once and you want all the lines to be updated on a push of a button.
Another example using a sales header & updating lines
1)I Always like a double checking question.
2)Set the range of the date you're looking for.
3)Find & Repeat until done.OnPush() IF NOT DIALOG.CONFIRM("Your Double Check Question",TRUE) THEN EXIT ELSE SalesLine.RESET; SalesLine.SETRANGE("Document Type","Document Type"); SalesLine.SETRANGE("Document No.","No."); IF SalesLine.FIND('-') THEN REPEAT >>>>Your Code between HERE Validate("Location Code", "FROM HEADER".Loccode); Etc. Etc. UNTIL SalesLine.NEXT = 0;
0
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