Hi,
I'm new to NAV and to this forum.
I have header and lines tables with card and listpart pages implemented. The header is sales order with associated sales order lines. The application will create orders addressed to vendors (there is a vendor field in the header). The order lines allow user to add items offered by the selected vendor to the order by selecting them using a lookup field.
I have implemented the tables and the lookup field (at present the loopup shows all items from the items table). I just don't know how I can restrict the items displayed in the lookup to the selected vendor in the header. Can someone help out with that?
Would greatly appreciate.
Cheers,
S
0
Answers
How have you added the lookup?
If you have added the table relation property you can like the vendor No. In item table with you vendor No.
If you have code OnLookup tigger you can item.setrange("vendor No.", yourOwnVendorNo);
But if you want to learn more about using lookup page, this blog may help you.
https://www.archerpoint.com/blog/Posts/dynamics-nav-how-program-lookups
Thanks,
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Thank you for your comments.
I have a Vendor table, I have an Items table with Vendor No. column with table relation to Vendor, I have a sales header table with a Vendor No. column with a table relation to Vendor (select a vendor for whom the order will be prepared - this is a purchase order), and sales line table with Item No. column. Now when a verdor is specified on the sales header page, the lookup on the subpage (sales line) should list items only of that specific vendor.
What I am unable to understand is how I can read the vendor no specified on the header page from the subpage to setrange for the dropdown.
Thank you for your help!
As I understand, you would like to send vendor no. from sales order header to be filter on item list while selecting no. in sales order subfrom (drilldown page is created from No.'s TableRelation), right?
If It's right, you may write you own code to handle lookup page for every sales line type (including, "G/L Account No.","Item", "Resource", "Fixed Asset", etc).
So, This code below will guide you to open lookup the pages for Item and G/L Account, you need to write more for Resource, Fixed Asset, etc.
Hope this will help you, thanks.
Thanks. This is very insightful code, and it almost worked! One thing I missed to mention was that I am using a delayed insert into the lines table, which made the validate stumble.
In the meantime I found a workround, by adding an additonal vendor field in the lines table (using it as a variable, and setting its value as part of the prim key) and using FIELD Filter.
I was surprised this worked :-). Your solution would be more elegant, but for the delayed insert.
Thank you!
Thanks for the hint. The error in VALIDATE came before MODIFY. I presume that VALIDATE itself tries to insert a value into field in a record, that doesnot yet exist... in any case this is just a presumption of a newbee :-)