Page:1

# TOPIC: x# transform() and SetCentury() issues

## x# transform() and SetCentury() issues 10 months 4 days ago #5810

 Topic Author Karl-Heinz Offline Posts: 258
Guys,

1. I´ve noticed that transform() adds unnecessary thousands separators

```?
? "SetThousandsep() " + chr (  SetThousandsep () ) // "."  ok
? "SetDecimalsep() " + chr (  SetDecimalsep () )   // ","  ok

? transform (    2.45 ,   "@R 999,999.99" )	// "   .  2,45"
? transform (   -2.45 ,   "@R 999,999.99" )     // "   . -2,45"
? transform (   24.58 ,   "@R 999,999.99" )	// "   . 24,58"
? transform (  -24.58 ,   "@R 999,999.99" )     // "   .-24,58"
? transform (  245.78 ,   "@R 999,999.99" )	// "   .245,78"
? transform ( -245.78 ,   "@R 999,999.99" )	// "  -.245,78"  <----
? transform ( 1245.78 ,   "@R 999,999.99" )     // "  1.245,78"     ok
? transform (-1245.78 ,   "@R 999,999.99" )     // " -1.245,78"     ok
? transform ( 1245.78 ,   "@R 999,999,999.99" ) // "   .  1.245,78"
? transform (-1245.78 ,   "@R 999,999,999.99" ) // "   . -1.245,78"
? transform ( 245.78 ,    "@R 999,999,999.99" )	// "   .   .245,78"
? transform ( 551245.78 , "@R 999,999,999.99" ) // "   .551.245,78"

// without thousand sep
? transform (   24.58  , "@R 999999.99" )    // "    24,58"   ok
? transform (  -24.58  , "@R 999999.99" )    // "   -24,58"   ok
? transform ( -234.45  , "@R 999999.99" )    // "  -234,45"   ok
? transform ( 234.45   , "@R 999999.99" )    // "   234,45"   ok
? transform ( -1234.45 , "@R 999999.99" )    // " -1234,45"   ok
? transform ( 1234.45  , "@R 999999.99" )    // "  1234,45"   ok
?

// problem with none floats

? transform ( -124 , "@R 999,999.99" )   // "   .  -,24"
? transform ( 124 , "@R 999,999.99" )    // "   .   ,24"

// without thousand sep
? transform ( -124 , "@R 999999.99" )    // "     -,24"
? transform ( 124  , "@R 999999.99" )    // "      ,24"
? transform ( -124 , "999999.99" )       // "     -,24"
? transform ( 124  , "999999.99" )       // "      ,24"

```

2. SetCentury() does not alter the year part of the date template.

Note: a german windows is used.
```LOCAL d AS DATE

d := condate ( 2018 , 8 , 12 )

// The default Setcentury() setting is false - VOs default is true
? Setcentury()    // false
// but the 4 digits year format is active
? GetDateFormat() // DD.MM.YYYY
? d               // 12.08.2018
?

SetCentury( FALSE )
// Setcentury() doesn´t change the date template.
// the 4 digits year format is still active.
? SetCentury()
? GetDateFormat() // DD.MM.YYYY
? d               // 12.08.2018
?
SetCentury(TRUE)
?
// force a 2 digits year display
// note: SetDateFormat() changes the SetCentury() setting automatically
SetDateFormat ( "DD.MM.YY" )
? Setcentury()  // ok, shows false now
? GetDateFormat() // ok DD.MM.YY
? d               // ok 12.08.18
?
// force a 4 digits year display
// note: SetDateFormat() changes the SetCentury() setting automatically
SetDateFormat ( "DD.MM.YYYY" )
? Setcentury()       // ok, shows true now
? GetDateFormat() // ok DD.MM.YYYY
? d               // ok 12.08.2018
?
```

SetCentury() should change the date template automatically, similar as SetDateFormat() automatically changes the SetCentury() setting.

regards
Karl-Heinz

## x# transform() and SetCentury() issues // misuse for enhancement plea 10 months 4 days ago #5811

 FFF Offline Posts: 571
Sorry for OT: could we have an extension to the "?" which automatically adds the expression to the output? E.g:
? DoW()
Resulting in:
Sunday // DoW()
Or similar.

Karl

## x# transform() and SetCentury() issues 10 months 2 days ago #5817

 robert Away Posts: 973
Karl Heinz,
Thanks for the examples. We will try to fix this for the next build.

Robert
XSharp Development Team
The Netherlands
This email address is being protected from spambots. You need JavaScript enabled to view it.

## x# transform() and SetCentury() issues 10 months 2 days ago #5818

 Topic Author Karl-Heinz Offline Posts: 258
Hi Robert,

At first glance it´s a little bit confusing that SetInternational () and SetCollation () process the same params.
"clipper", "Windows", "unicode" or "ordinal". But in the meantime it´s clear how Setinternational() handles "unicode" and "ordinal".

SetInternational ( #unicode )
? SetInternational() // falls back to "windows"

SetInternational ( #ordinal )
? SetInternational() // falls back to "windows"

I´ve noticed that SetInternational() no longer adjusts the collation setting automatically . Maybe i overlook something, but why not set the collation automatically according the SetInternational() param ?

e.g.

SetInternational ( #unicode )

would result in:

SetInternational() == Windows
SetCollation() == unicode

regards
Karl-Heinz

## x# transform() and SetCentury() issues 10 months 1 day ago #5821

 robert Away Posts: 973
Karl Heinz,

I am working on documentation for this.
Short version: SetInternational only #Windows and #Clipper
This controls how date format time format and decimal and thousand seperators are defined.

SetCollation #Windows, #Clipprt, #Unicode and #Ordinal. This determines the sort order and string comparisons.

Robert
XSharp Development Team
The Netherlands
This email address is being protected from spambots. You need JavaScript enabled to view it.
 Page:1