Hi, I have some problem with this part of my code:
IF EVALUATE(StatusValue,ValueArray[1]) THEN BEGIN
SETRANGE(Status,StatusValue);
END
StatusValue is global variable, type Option;
ValueArray is type of text
Something is wrong with EVALUATE, because if I put only EVALUATE(StatusValue,ValueArray[1]) I have a messagebox:
You cannot enter 'Status::Released' in Option.
:-k
Thnx
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
It's the value from the field of my table UserFilter(field type is Text)
Thnx
Setrange expects the same datatype as the field, setfilter accepts strings.
You might have to remove the Status:: from the string.
This is the source of the problems... :-)
And do not forget, that you will have problems when you switch your language...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
You are right in using EVALUATE for this purpose, but you're going about it incorrectly. Syntax like 'Status::Released' is the C/AL code way to designate an option value. Internally, the database stores it as an integer (so you could even just set the filter on the integer value if you know which value that is). The text representation of the option value is just the word that belogns to the option, in your case that would be 'Released'.
So, try setting your array value to 'Released' and see if that works.
RIS Plus, LLC
I don't think you have to use the evaluate function in this case. If the string in the user setup table is correct you should only have to make something like
SETFILTER(Optionfield, UserSetup.Optiontext);
Just make sure the text value in the usersetup has the right syntax.
OK, let me explain, in Sales Header table, Status field is type of Option, and if I want to do this:
SETFILTER(Status, MyTable.Optiontext);
I will get an error in compile time: Type conversion is not possible because...
Option := Text
and I must do EVALUATE, right!?
misha
I think you are getting SETFILTER and SETRANGE mixed up :?
Have you tried it??
Make a small test:
But, another problem is when I switch between languages, because, optionstring is text and it's value depend from chosen laguage........example:
Status::Released (in english) <-> Status::Lansiran (in serbian)
A workaround can be to work with numbers or to just write some more code.
You can also replace the text field in the user settings by an option string.
Do you want to filter on one option only or do you want to set multiple filters like "Quote|Order"??
RIS Plus, LLC
RIS Plus, LLC
RIS Plus, LLC
RIS Plus, LLC
RIS Plus, LLC
Go right ahead.
One option only....
Sorry for highjacking your topic :oops: