Field is no code field
Red-Eagle
Member Posts: 107
I have now a working dataport (with some hulp from this forum, thanks again), but i have a small problem.
In the purchase line table their is a field called "Manufacturer". I want to link this field at ETIM Vendor (Central Mgt) table. The problem is that the keyfield of this table is "Code", but i need to link it at the field "Alternative Vendor Code" which is the same as Manufacturer.
The Manufacturer says for example 'ABB'
This is a example of this table.
Code Alternative Code
8712507900029 ABB
ABB ""
The problem is that when you choose Code you will find 'ABB' but then the field "Alternative Vendor Code" is empty.
In the purchase line table their is a field called "Manufacturer". I want to link this field at ETIM Vendor (Central Mgt) table. The problem is that the keyfield of this table is "Code", but i need to link it at the field "Alternative Vendor Code" which is the same as Manufacturer.
The Manufacturer says for example 'ABB'
This is a example of this table.
Code Alternative Code
8712507900029 ABB
ABB ""
The problem is that when you choose Code you will find 'ABB' but then the field "Alternative Vendor Code" is empty.
0
Answers
-
I "think" I understand what you are looking for, to be able to select a value from a table that is not its key.
You would need to add code on the OnLookup and OnValidate to make this work and remove the TableRelation. Add this on the table level and not the form level so it applies everywhere the field is shown.OnLookup ETIMVend.Reset; <Apply needed filters to ETIMVend> If Form.Runmodal(0,ETIMVend) = Action::Lookupok then Manufacuter := ETIMVend."Alternative code";
You would also need to add it to the OnValidate to ensure that if a user does not lookup but type in a value it does not accept it without checking.OnValidate If (Manufacturer <> '') and (Manufacturer <> Xrec.Manufacturer) then begin ETIMVend.Reset; <Depending on your database and table records you might want to apply a new key and setcurrentkey) <Apply needed filters to ETIMVend> ETIMVend.Setrange("Alternative code", Manufacturer); If ETIMVend.IsEmpty then FieldError(Manufacter) End;
I just knocked this up without writing it IN Nav, so you may need to tweak it as needed, I also could have missed what you were looking for completelty.
t0 -
I need it only for this dataport, but i was thinking. Isnt it possible to get the code ABB (which it is in the table) and then look for a field in that table where the alternative Vendor Code is the same and then get the code which is mentioned with that alternative vendor Code?0
-
Sorry, was speed reading, missed the "Dataport" part...
But now I am a little confused as to what you are looking for...
t0 -
Okay i will try to give you more information.
This is how the table (ETIM Vendor (Central Mgt)) is loooking.
Code...................Name...............................................Vendor.............................................Alternative Vendor Code
8712507900029.....ABB Systeemcomponenten................................................................................ABB
8714252011920.....Phoenix Contact..............................................................................................PHO
ABB.....................ABB Systeemcomponenten....................L1005......................................................''
PHO.....................Phoenix Contact................................ L1044......................................................''
I have from the purchase line table the field Manufacturer, which is for example 'ABB'. Now is it possible to link this field to the code field in table ITEM VENDOR, that isnt the problem. As you can see the same code is find in the field Alternative Vendor Code. What i want is to link to that field, so that i cen get de code which al those numbers in this case 8712507900029.0 -
If I understand you properly something like this should work:
ETIMVend.SETRANGE("Alternative Vendor Code",PurchLine.Manufacturer);
IF ETIMVend.FINDSET THEN //This might find several lines with PurchLine.Manufacturer, you have to decide how to handle this
REPEAT
ETIMvendorCode := ETIMVend.Code;
UNTIL ETIMVend.NEXT = 0;
If several lines are found the variable ETIMVendorCode will get the last one with the above code. Might not be what you want.0 -
Thank you for the help
The problem is solved. Only i did it just a little bit different:
Etimvendorrec.SETCURRENTKEY("Alternative Vendor Code");
Etimvendorrec.SETRANGE("Alternative Vendor Code","Purchase Line".Manufacturer);
IF Etimvendorrec.FIND ('-') THEN
IF Manufacturer <> '' THEN BEGIN
vEtimEAN := Etimvendorrec.Code;
END ELSE BEGIN
vEtimEAN := '';
END;
It working so i am very happy now!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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 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