"DECODE" command generates
output code based on comparison of 1st
parameter with set of alternative values. Generator compares 1st
parameter to each value one by one. If expr is equal to a value,
generator returns the corresponding result. If no match is found,
generator returns default, or, if default is omitted, returns nothing.
Command syntax has two forms
Syntax1
%decode<value:variant1:result1:variant2:result2:...:variantN:resultN:default
result>
Syntax2
<decode>value<,>variant1<=>result1<,>variant2<=>result2<,>...<,>variantN<=>resultN<,>default
result<enddecode>
Note - in short form you can not use keywords like <1>,
instead you can use %1%.
To generate correct string
conversion function use the following code
(note - generator constant <\> is used for template formating
purpose only)
<decode>%.type%<,><\>
string<=>%.name%<,><\>
integer<=>IntToStr(%.name%)<,><\>
float<=>FltToStr(%.name%)<,><\>
/*ERROR - unsupported
type %.type%*/<\>
<enddecode>