How copy fields from a table to a another one automatically

Mic28
Member Posts: 13
Hi everybody; I have two new fields (are "down" fields) on Vendor table, and I want to copy the content from these fields to the same Item table fields automatically, for not have to go product by product. I would be comparing the "Vendor No." for example. I think it can be done through a report that launch an automated process. Can anyone explain me how can I do it, please?.
Thanks in advance.
Thanks in advance.
0
Comments
-
Can you use flowfields for this?
Maybe it is a good idea to start reading the Application Designer guide or purchase David Studebakers book.
http://www.packtpub.com/Microsoft-.NET- ... ision/book0 -
Thanks both for reply; I prefer don't use flowfields because, in future, it always becames a problem (if you want to create "keys" with these fields, for example).
"Down" fields are expand fields, I mean, it looks for a table and you choose the code (like an option field), sorry. Any idea please?.
Thanks.0 -
as Mark said, you should study before implementing anything...it's clear that you don't know what is a lookup field, or you explained really bad or i understood really bad
(e.g. i think you want to have a field like shipment code on sales order). This is a basic knowledge to have.
If you really want to do this, just check the field i said, take a look at his properties and make your considerations.
hint: table relation property0 -
You cannot create a tablerelation to a non-primairy key field.
Your new fields should refer to a code table like payment terms, country/region or something alike.0 -
Thanks everybody for reply. It's clear that I've explained very bad, sorry for it. I know that I can use flowfields, but I don't want to do it because if I do that I'll can't change the field in product label, it always will copy from vendor. I'll try to explain me with detail.
The two new fields in vendor table are already informed. I've created the same fields on Item table that now are empty. On "Vendor Nº." trigger from Item table I've created the instrucction:
Field1:=vendortable.Field1;
Field2:=vendortable.Field2;
Then, when I create a new item it gets the content from filed1 form vendor table. It runs me well. But, what about the items that have also been created?, I should be inform all the items one by one?. So I need to launch an automatic process that fill that fields automatically, I suppose filtering by vendor number. Somethig like:
If vendor n=12525 then field1:='example';
I hove I've explained well; sorry for confusion.
Thanks.0 -
Is
Field1:=vendortable.Field1;
Field2:=vendortable.Field2;
on the Onvalidate trigger of "Vendor No" in the item table? not form.
If so and you have that working, it appears you want to fill in all the old items with an update report.
Dataitem->Item
Global Variable -> Vendor=Record=Vendor
OnAfterGetRecord()Clear(Field1); Clear(Field2); If Vendor.GET("Vendor No.") then begin Field1:=vendor.Field1; Field2:=vendor.Field2; Modify; End;
When you run the report you can filter on when these fields are blank so just those get updated.
I hope this is what you were looking for.
Do you have the Application Designers Guide?0 -
Perfect, It works!!!, thanks for your help and time.
Thanks again.0 -
-
You might want to put a call to an new function say "UpdateItemsFromVendor" in the vendor tables OnModify trigger. The new function should update field1 and filed2 on all items with the current Vendor No.
It could look something like this:
recItem.RESET();
recItem.SETRANGE("Vendor No.",No.);
IF xRec.Field1 <> Rec.Field1 THEN
recItem.MODIFYALL(Filed1,Filed1);
IF xRec.Field2 <> Rec.Field2 THEN
recItem.MODIFYALL(Filed2,Filed2);
recItem.SETRANGE("Vendor No.");
This way the item table will be automatically uppdated when ever someone changes the values of field1 och 2 in the vendor table unless the vendortable is updated by code that doesn't call the OnModify trigger.0 -
Mark Brummel wrote:You cannot create a tablerelation to a non-primairy key field.
Actually you can do this. But if you do it will then be impossible to ever rename tables in Navision on that database, it will give an error that you need to include that field in a key in the table. And no hint at all where to find the problem.
This was introduced in Navision ver. 1.1 to allow upgrades from 3.55, and to the best of my knowledge the bug has never been fixed. I reported it many times.David Singleton0 -
David Singleton wrote:Mark Brummel wrote:You cannot create a tablerelation to a non-primairy key field.
Actually you can do this. But if you do it will then be impossible to ever rename tables in Navision on that database, it will give an error that you need to include that field in a key in the table. And no hint at all where to find the problem.
This was introduced in Navision ver. 1.1 to allow upgrades from 3.55, and to the best of my knowledge the bug has never been fixed. I reported it many times.
EDIT: sorry, it does not work...after clicking another field, the error line of RTC appeared in the header of the page...too bad... ](*,)
well, it was not so important...0 -
Belias wrote:David Singleton wrote:Mark Brummel wrote:You cannot create a tablerelation to a non-primairy key field.
Actually you can do this. But if you do it will then be impossible to ever rename tables in Navision on that database, it will give an error that you need to include that field in a key in the table. And no hint at all where to find the problem.
This was introduced in Navision ver. 1.1 to allow upgrades from 3.55, and to the best of my knowledge the bug has never been fixed. I reported it many times.
EDIT: sorry, it does not work...after clicking another field, the error line of RTC appeared in the header of the page...too bad... ](*,)
well, it was not so important...
Just tried 2009SP1 Classic and the error is still there. Trying RTC now.David Singleton0 -
Tested in RTC, Same error.
Can you let me know how you did it to make it work.David Singleton0 -
Import this object:
OBJECT Table 50000 Test IPG { OBJECT-PROPERTIES { Date=02/03/10; Time=18:12:48; Modified=Yes; Version List=; } PROPERTIES { } FIELDS { { 1 ; ;Code ;Code10 } { 10 ; ;Inventory Posting Group;Code10 ;TableRelation=Item."Inventory Posting Group"; CaptionML=ENU=Inventory Posting Group } } KEYS { { ;Code ;Clustered=Yes } } FIELDGROUPS { } CODE { BEGIN END. } }
You just need to import it, nothing else.
Then try to rename any item.David Singleton0 -
David Singleton wrote:Tested in RTC, Same error.
Can you let me know how you did it to make it work.0 -
Belias wrote:David Singleton wrote:Tested in RTC, Same error.
Can you let me know how you did it to make it work.
:x :x :x :x :x
Edits should only be for mistakes in grammar etc. If the whole post changes add a new post so its clear.
[-(David Singleton0 -
Belias wrote:i edited it just 3-4 min. after...sorry to spare your time
No problem, I was very interested to find out if they had actually finally fixed this.
Did you import my object to see that the bug is still there?David Singleton0
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