Skip to content

"TRANSFORM( ) Function" : Request for tests - comments for update vfp9 help file #8

Open

Description

@FrancisFaure

"TRANSFORM( ) Function"

current VFP9 Help File :

 Numeric (includes Double, Float, or Integer data types)

Removes trailing zeros from the decimal portion of a numeric value when all the numbers following the decimal point are zeros.
If the numeric value is a whole number, a decimal point is not included in the transformed value, for example, 4.0 is transformed to 4.
If the numeric value is less than one but greater than negative one, zero is included before the decimal point, for example, .4 is transformed to 0.4.

but:

clear
#define C_FONT font "courier", 9 style "N"
? "--------------------------------------------------------------------" C_FONT
? "Tests 'TRANSFORM(eExpression, [cFormatCodes])' page in vfp9 helpfile" C_FONT
? "--------------------------------------------------------------------" C_FONT
*
? "SET DECIMALS TO 2 (default)" C_FONT
? "SET FIXED OFF     (default)" C_FONT
set decimals to 2
set fixed off
i = 1.2345
? "m.i=" C_FONT, m.i C_FONT && 1.2345  <------- OK
? "TRANSFORM(m.i) =" C_FONT, transform(m.i) C_FONT && 1.2345  <------- OK
? "TRANSFORM(m.i, '9999.9999') = " C_FONT, transform(m.i, "9999.9999") C_FONT && 1.2300 -> depending of 'SET DECIMALS TO' undocumented
?
*
? "SET DECIMALS TO 2 (default)" C_FONT
? "SET FIXED ON" C_FONT
set decimals to 2
set fixed on
i = 1.2345
? "m.i=" C_FONT, m.i  C_FONT && 1.23 -> depending of 'SET FIXED' + 'SET DECIMALS TO' undocumented in "? | ?? Command" page
? "TRANSFORM(m.i) =", transform(m.i) C_FONT && 1.23 -> depending of 'SET FIXED' + 'SET DECIMALS TO'  undocumented in "TRANSFORM( ) Function" page
? "TRANSFORM(m.i, '9999.9999')= ", transform(m.i, "9999.9999") C_FONT && 1.2300 -> depending of 'SET DECIMALS TO' undocumented in "TRANSFORM( ) Function" page
?
*
? "SET DECIMALS TO 3" C_FONT
? "SET FIXED OFF     (default)" C_FONT
set decimals to 3
set fixed off
i = 1.2345
? "m.i=" C_FONT,  m.i C_FONT && 1.2345  <------- OK
? "TRANSFORM(m.i) =" C_FONT, transform(m.i) C_FONT && 1.2345 OK
? "TRANSFORM(m.i, '9999.9999') = " C_FONT, transform(m.i, "9999.9999") C_FONT && 1.2350 -> depending of 'SET DECIMALS TO' undocumented (and round)
?
*
? "SET DECIMALS TO 3" C_FONT
? "SET FIXED ON" C_FONT
set decimals to 3
set fixed on
i = 1.2345
? "m.i=" C_FONT, m.i C_FONT && 1.235 -> depending of 'SET FIXED' + 'SET DECIMALS TO' undocumented in "? | ?? Command" page
? "TRANSFORM(m.i) =", transform(m.i) C_FONT && 1.235 -> depending of 'SET FIXED'' + 'SET DECIMALS TO' undocumented in "TRANSFORM( ) Function" page
? "TRANSFORM(m.i, '9999.9999')= ", transform(m.i, "9999.9999") C_FONT && 1.2350 -> depending of 'SET DECIMALS TO' undocumented
?

*------------------------------------------------
* "TRANSFORM( ) Function" page
*
* TRANSFORM(eExpression, [cFormatCodes])
*
* Numeric (includes Double, Float, or Integer data types)   part :
* in a good english : 
*
* add text for [cFormatCodes] depend of "SET DECIMALS TO" Command (but NOT  "SET FIXED" command ?)
*            if [cFormatCodes] missing : depend of "SET FIXED" + "SET DECIMALS TO" commands
* and see, the actual informations :
*     "...Removes trailing zeros from the decimal..."
*
* Add in "See Also"
* SET DECIMALS Command
* SET FIXED Command
*------------------------------------------------
* "? | ?? Command" page
*
* Add text about depend of 'SET FIXED' + 'SET DECIMALS TO' commands ?
*
* Add in "See Also"
* SET DECIMALS TO Command
* SET FIXED Command
*------------------------------------------------
* in all "SET" commands :
*
* Add in "See Also"
* SET( ) Function
*------------------------------------------------

Activity

  1. self-assigned this
    on May 21, 2020
  2. lscheffler commented on Jun 25, 2022

    @lscheffler

    @FrancisFaure I'm a little bit reluctant to go into this. TRANSFORM() is, in my not so humble opinion, unreliable at least. It respects any odd SET, but in a strange way. So I have no good idea to express the issue.

    For additional example, play with SET POINT. And I have situations where I've was unable to find out how to set SET FIXED / SET DECIMALS to get what I need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions