Filtering Lookups
A coworker sent me an email today asking about a SQL query for returning results based on the value in a setup table. I sent him the correct syntax and then inquired as to the purpose of this. His response was that he had a request from a customer to filter the item lookup on the sales line table based on a setting in Sales & Receivables Setup. He was going to use a table linked to a view, which among other things would be rather messy. I then proceeded to show him the following method for creating a filtered lookup. It is a little known fact that code in the OnOpenPage trigger of a lookup page is executed when the lookup dropdown is displayed. Here is a lookup to the item table in a Cronus database. Now, let's say we want to filter to just items beginning with "11". We could add this code to the OnOpenPage trigger of the Item List. Now the lookup returns this. Now, what if we want to make it conditional? In this case, the fi...