Hi all.
I have the following problem.
I have a field "Vendor No." in a table that is related to the Vendor table, but in the OnLookup trigger I want to restrict the displayed values.
So, I create a temporary table VendorsTemp (T23) and a form VendorList (F27).
I use the following code in the OnLookup trigger of the "Vendor No." field to fill the temporary table VendorsTemp.
PurchRcptLineAssgmnt.SETRANGE("Document No.", "Document No.");
PurchRcptLineAssgmnt.SETRANGE("Document Line No.", "Document Line No.");
IF PurchRcptLineAssgmnt.FIND('-') THEN
REPEAT
IF Vendors.GET(PurchRcptLineAssgmnt."Vendor No.") THEN
BEGIN
VendorsTemp.INIT;
VendorsTemp := Vendors;
VendorsTemp.INSERT;
END;
UNTIL PurchRcptLineAssgmnt.NEXT = 0;
The VendorsTemp table gets filled OK.
How do I display the VendorList form as Lookup and when the user clicks on a Vendor, the field "Vendor No." is filled in appropriately?
I tried some approaches, but I can't get it to work right.
Any suggestions?
Jorgito
Comments
RIS Plus, LLC
http://www.mibuso.com/forum/viewtopic.php?t=9478
http://www.mibuso.com/forum/viewtopic.php?t=5180
etc.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Afterwards VendorsTemp contain the selected records.
I used the following code
But I have 2 problems:
1. All the records from the Vendor table are displayed and not the ones in the VendorsTemp record.
2. When I double click on a vendor in the form, the original field does not change.
What am I doing wrong?
Jorgito
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I tried using the following code
Now, the correct records are displayed in the lookup window, but when I click on OK, the value is not transferred in the original table.
If I use the MESSAGE function to find out the value that is returned, it is the correct one. But the original field is not updated with the value I clicked on in the lookup form.
Thank a lot
Jorgito
Rec."No." := VendorsTemp."No.";
You should use:
Rec.GET(VendorsTemp."No.");
...
/Frank
I found in another topic that when you set the value of the field after the user has clicked on OK, you must use instead of
And if you are viewing the table from the Object Designer, the value is not transferred from the lookup table to the field.
Instead, if you run the FORM and try to use the lookup table, the field gets updated normally.
http://www.mibuso.com/forum/viewtopic.php?t=8143
Thanx everyone for your help
Jorgito
The Table Relation works just fine:
IF (Order Type=CONST(" ")) Vendor ELSE IF (Order Type=CONST(Controlled)) Vendor WHERE (Status=FILTER(<>'')) ELSE IF (Order Type=CONST(Ancillary)) Vendor
This works also with using a FILTERGROUP in the Vendors List form:
UserSetup.GET(USERID);
FILTERGROUP(10);
IF UserSetup."Block Old Vendors" THEN
SETFILTER("No.", '<%1','X');
FILTERGROUP(0);
Bye the way, I wanted to use a filter like '<>%1', 'X*'
But that will not work, anyone know why?