Implicit Type Conversion

Author: norbert.lauterbach@infraserv.com (Lauterbach)

Helpfile : Table 1. Implicit Type Conversion in Assignments  

Target

Source

Result

Numeric

String

  • If possible, String converted to Numeric value (as with $number).

  • Otherwise, Numeric is 0.

Asn: $NLS_LOCALE         de_DE          $NLS_FORMAT         classic   Proc: string V_VAL numeric V_NUMBER $nlsformat = "nlslocale" V_VAL = "4,08" V_NUMBER = V_VAL ; --> 4 V_NUMBER = $number(V_VAL) ; --> 4.08

1 Comment

  1. The described behavior is correct. I, however, agree that the documentation could be a bit clearer about how implicit type conversion is working. Internally Uniface will always use the period (. ) as decimal separator (and this is regardless of the NLS settings). In case you set V_VAL to "4.08" (in the Proc code you've mentioned) then V_NUMBER will always have the value 4.08 after the implicit type conversion (independent of which NLS locale is used). I think it's better to use explicit type conversion (by using e.g. $number) where necessary instead of relying on the implicit type conversion. I hope this helps. Regards, Daniel Iseli Uniface Technical Support


    Author: diseli (daniel.iseli@uniface.com)