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.
0
Answers
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.
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.
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.
t
But now I am a little confused as to what you are looking for...
t
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.
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.
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!