Case statement
Can the Case statement in RAP use a Char, or is it limited to only
evaluating numbers? For example:
procedure Variable1OnCalc(var Value: Variant);
var
c: Char;
begin
c := Copy(Fields['Record Type'], 1, 1);
case c of
'H': Value := 'Highrise';
'S': Value := 'Street';
end;
end;
This gives an error: "Variable1OnCalc, Line 7: Expected number or '-',
but found 'H' instead."
We are using RB Enterprise 9.02 for Delphi 7.
Thanks,
Jim Shawver
BCC Software Inc.
evaluating numbers? For example:
procedure Variable1OnCalc(var Value: Variant);
var
c: Char;
begin
c := Copy(Fields['Record Type'], 1, 1);
case c of
'H': Value := 'Highrise';
'S': Value := 'Street';
end;
end;
This gives an error: "Variable1OnCalc, Line 7: Expected number or '-',
but found 'H' instead."
We are using RB Enterprise 9.02 for Delphi 7.
Thanks,
Jim Shawver
BCC Software Inc.
This discussion has been closed.
Comments
The RAP case statement only accepts ordinal values similar to the way the
Delphi case statement functions.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Sorry I did not see you were using Char types and I miss-used the word
"ordinal". RAP does not have the capability of using Char values in a Case
statement only numerical values. One option would be to implement the Ord
function in a passthru function and call that on each character given.
It is on our todo list to possibly add the Ord function to the RAP language
for a future release of ReportBuilder.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com