Can anyone with expirence with the option datatype give me some help? I have a field "X" setup as an option type with "A" and "B" as the values to choose from. I know I can use IF X::A THEN to catch if the value is "A" but how can I determine if the user hasn't set the option? How can I test for null?
0
Comments
IF X = X::" " THEN
Error('Select an option.')
else if x = x::b then
case x of
x::a:;
x::B:;
end;
If you want a blank; ad an optionstring:
,A,B
Then defualt is
x::" "
Greetz,
Marq
RIS Plus, LLC
Failed with the error "Option must not be blank. Option missing or invalid in the expression."
The second reply covers the logic I need to react to "A" or "B" as the answer but that's not what I am looking for.
What I am looking to test here is to determine if the user hasn't selected any value and the field is essentially null. How can I test for that?
You can always learn from 'standard Navision'. One of the bennefits op 'open source'.
Greetz,
Marq
RIS Plus, LLC
I believe Mark is right about how to test for this value. If that doesn't help, you can do:
RIS Plus, LLC
Blablablabalbla;
This will also work....
Rgds,
Jon.
Jon.
Yes, this also works, but I don't think I is advisable to learn people on this forum to program like this.
Some thinks that work are not recomendable for programming.
Regards,
Mark
However..... it is a LOT nicer to read if it says X::"My Option Value x", because then you can see right away that 1) the variable/field is an option type field and 2) what the functional value is. With your method, you will have to research the type of the variable/field, and then browse into the property pages to find out what the value represents.
OR, you have to put a comment behind the value like this Which, in all fairness, a little silly. If you're going to type the meaning of the integer value in a comment, why not program it that way to start out with.
An additional advantage is that if you decide to change the option string, it will show the new option value next time you open the C/AL editor.
RIS Plus, LLC
Anyway, advise taken and noted.
Rgds,
Jon.
Jon.