TableRelation and TableFilter strange problem

I have problem to solve this problem. Task: In ‘Sale Order’ customer wants select on lines ‘Location Code’ only from f.e. AAA or BBB. I have Locations (Code - AAA, Name - aaa),(Code - BBB, Name - bbb) So I defined in table ‘Sales Line’, attribute ‘Location Code’ TableRelation as: Location.Code WHERE (Code=FILTER(AAA|BBB)), but this DIDN’T WORK, I saw all locations. If I tried to change Field Code to another one, f.e. to Name: Location.Code WHERE (Name=FILTER(aaa|bbb)) everything worked OK and I saw only 2 record: AAA - aaa, BBB - bbb. Any suggestion ? Note: Used NA 3.01B

Hi Jozef, I think the filters on table relations are supposed to be for other fields than the one you are creating a reference to. But more importantly there is a good Navision rule that will save you a lot of work (and others after you) : NEVER HARCODE things. [;)] That is if your customer wants to see certain locations only, then you just add a field to location table: for sales lines (or something). Then you add code on OnLookUp to filter only on those and also OnValidate to make sure that the Code is allowed. Or if it is by user than you make a table with User and Location codes allowed and then add code. It may take you a bit more to do but if they ever change their mind about which locations to use (and they will [}:)]) then you do not have to change anything: it will be just a matter of setup. And also NEVER filter on things like descriptions and names … Hope that helps … Cristi