fbpx

x# transform() and SetCentury() issues

  • Karl-Heinz Rauscher
  • Karl-Heinz Rauscher's Avatar Topic Author
  • Offline
More
5 months 1 week ago #1 by Karl-Heinz Rauscher
x# transform() and SetCentury() issues was created by Karl-Heinz Rauscher
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

Please Log in or Create an account to join the conversation.

More
5 months 1 week ago #2 by Karl Faller
Replied by Karl Faller on topic x# transform() and SetCentury() issues
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

Please Log in or Create an account to join the conversation.

More
5 months 1 week ago #3 by Robert van der Hulst
Replied by Robert van der Hulst on topic x# transform() and SetCentury() issues
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.

Please Log in or Create an account to join the conversation.

  • Karl-Heinz Rauscher
  • Karl-Heinz Rauscher's Avatar Topic Author
  • Offline
More
5 months 1 week ago #4 by Karl-Heinz Rauscher
Replied by Karl-Heinz Rauscher on topic x# transform() and SetCentury() issues
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

Please Log in or Create an account to join the conversation.

More
5 months 6 days ago #5 by Robert van der Hulst
Replied by Robert van der Hulst on topic x# transform() and SetCentury() issues
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.

Please Log in or Create an account to join the conversation.