Coding Best Practices - Custom Lookups

Mike_HWGMike_HWG Member Posts: 104
I have a situation where I'm building a table called Market Update Subscription. I want one of the fields to look up to another table. However, the filter on the lookup table is complex: I want the "Cust. Mkt. Update File Formats" table filtered by either blank values or the Customer No.

At the moment, I have the following code in my Market Update Subscription table:
File Format - OnLookup()
WITH MarketUpdateFileFormat DO BEGIN
  RESET;
  FILTERGROUP(100);
  SETFILTER("Customer No.",'''''|%1',REC."Customer No.");
  FILTERGROUP(0);
  IF FORM.RUNMODAL(FORM::"Cust. Mkt. Update File Formats",MarketUpdateFileFormat) = ACTION::LookupOK THEN
  REC."File Format" := "File Format";
END;

The reason I added it to the table is that I want this to be the standard behavior for this field. However, I've usually seen lookups of this structure added to the form....

Is it better practice to have this code in a form instead?
Michael Hollinger
Systems Analyst
NAV 2009 R2 (6.00.34463)

Answers

Sign In or Register to comment.