Hi,
I'm trying to find all records in the table 5054 "Contact Business Relation" with "Customer" on the field "Link to Table". The "Data Type" of this field is "Option":
filter.jpg
When I set a filter like....
ContactBusinessRelation.SETFILTER("Link to Table", 'Customer');
.... it works fine if the language in NAV is set to English. If the language in the NAV Client is set to another language, it's not working ](*,)
Is it possible to set set a language-neutral filter ?
Answers
You should write your code like this:
The way you have written the code, you are trying to do an implicit conversion between a type of string to a type of option. The way the implicit conversion is handled varies depending on your language setting.
If you use the NAV representation of the value you don't have a problem.
But how does it works ? #-o The implicit conversion is clear, but what's the meaning of :: between "Link to Table"::Customer ?
Freelance Developer
Another example:
Status is an option-field with 2 options Open and Released.
IF Status = Status::Released THEN...
Tino Ruijs
Microsoft Dynamics NAV specialist
Freelance Developer
Than whatever language you have set the application in will compile if have the right optionstring for that language entered in C/AL.
However, when you look at the code the next time you open it, I believe your code will be in the default Language.
Freelance Developer
What you are entering in the code is what is in the "OptionString" which is not language depending. Just the captions, which are used in the user interface depends on the language.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Freelance Developer