Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>transform()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
TRANSFORM()


Syntax:     TRANSFORM(<exp>, <expC>)

Purpose:    To format the results of an expression of any data type.

Arguments:  <exp> is the character, date, or numeric expression to
            format.

            <expC> identifies the format of the returned character
            string.

Returns:    A character string.

            TRANSFORM() takes the result of an expression of any data
            type and returns a formatted character string according to
            the template specified by <expC>.

Usage:      TRANSFORM() allows you to format character, date, or numeric
            expressions in the same way you would with @...PICTURE
            converting each to a character string matching the specified
            format.  The following is a complete list of functions and
            templates that TRANSFORM() supports.  Refer to @...PICTURE
            for a complete discussion on how picture functions and
            templates work.

            Note that since TRANSFORM() returns a character string, it
            does not solve the problem of formatting a totalled field in
            a REPORT FORM.


            Table: TRANSFORM() Functions
            ---------------------------------------------------------------
            Function    Action
            ---------------------------------------------------------------
            B     Displays numbers left-justified
            C     Displays CR after positive numbers
            D     Displays date in SET DATE format
            E     Displays date in British format
            R     Non-template characters are inserted
            X     Displays DB after negative numbers
            Z     Displays zero as blanks
            (     Encloses negative numbers in parentheses
            !     Converts alphabetic characters to upper case
            ---------------------------------------------------------------


            Table: TRANSFORM() Templates
            ---------------------------------------------------------------
            Template       Action
            ---------------------------------------------------------------
            A,N,X,9,#   Displays digits for any data type
            L           Displays logicals as "T" or "F"
            Y           Displays logicals as "Y" or "N"
            !           Converts an alphabetic character to upper case
            $           Display a dollar sign in place of a leading
                        space in a numeric
            *           Displays an asterisk in place of a leading space
                        in a numeric
            .           Specifies a decimal point position
            ,           Specifies a comma position
            ---------------------------------------------------------------


Library:    CLIPPER.LIB


----------------------------------- Examples -------------------------------

   The following example formats a number into a currency format using a
   template:

   ? TRANSFORM(123456, "$999,999")     && Result: $123,456

   The following example formats a character string using a function:

   ? TRANSFORM("to upper", "@!")       && Result: TO UPPER


See Also: @...SAY...GET LOWER() STR() UPPER() Currency()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson