In CSIDE, I try to use this code:
IF "VAT-Type".Nummer = 1 THEN
GLE2.SETFILTER("Gen. Posting Type",'%1',"Gen. Posting Type"::Purchase)
ELSE IF "VAT-Type".Nummer = 2 THEN
GLE2.SETFILTER("Gen. Posting Type",'%1',"Gen. Posting Type"::Sale)
ELSE IF "VAT-Type".Nummer = 3 THEN
GLE2.SETFILTER("Gen. Posting Type",'%1',"Gen. Posting Type"::" ");
I try to set the right filter on the field "Gen. Posting Type" of the G/L Entry-table. This field is an option field with three options: Purchase, Sale and '' (empty). Can anybody tell me how I should refer to the empty option value in my code? I now use
" " because it's the only way to get the report compiling, but it seems to me that this is not the correct way to set the right filter.
Comments
PaLPiTaTioN, it`s absolutely correct way
Of course this code is correct only if OptionString for GLE2."Gen. Posting Type" is: Purchase, Sale,' '.
Mention the comma before Purchase, this one defines the empty value.
And remember: Whenever there are spaces in "object qualifier" (variable name, field name, option value name...) object qualifier must be enclosed with double quotes.
(one of the reasons why variable names are witohuot spaces, is that the code is more clear...)
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
You can type
GLE2.SETFILTER("Gen. Posting Type","Gen. Posting Type"::"0");
in the C/AL-Editor and the compiler converts this to
GLE2.SETFILTER("Gen. Posting Type","Gen. Posting Type"::" ");
if the optionstring is
,Purchase,Sale
br
Josef
Josef Metz