Home RAP
New Blog Posts: Merging Reports - Part 1 and Part 2

Case statement

edited February 2009 in RAP
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.

Comments

  • edited February 2009
    Hi Jim,

    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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2009
    "Nico Cizik \(Digital Metaphors\)" wrote
  • edited February 2009
    Hi Jim,

    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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.