Extention error: Not supporting Date type in Case statement.
We have written the following code in C/AL and converted into AL.
Case DateFilter of
0D : Statement1;
12252018D: Statement12;
Else
Statement3;
END;
When i compile the code in VS code environment i am getting below error.
error CS0151: A switch expression or case label must be a bool, char, string, integral, enum, or corresponding nullable type
Is variable DateFilter really of data type Date, not Text?
HI NKarolak,
Yes, it is data type of Date only.
Hi @Nagaraju17 ! This should work. A Date literal is of the form: yyyymmdd followed by the letter D: For example: 20180101D -> 2018, January, 1st 20001201D -> 2000, December, 1st
If you use a value that is outside the range of a valid date: 20002501D -> 2000, month 25, 1st
you will get an error.
Constant value '20002501D' is outside the range for a Date
We will add more documentation about the format of Date, Time and DateTime literals.