11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

You can include the decimal option to control the number of fractional digits returned, afterrounding is performed. The decimal parameter must evaluate to an integer. For example,assume that variable c contains the number 6.25198.SET c="6.25198"SET x=$FNUMBER(c,"+",3)SET y=$FNUMBER(c,"+",8)WRITE !,x,!,yThe first $FNUMBER returns +6.252 and the second returns +6.25198000. Zero fill is performedif the decimal parameter exceeds the number of fractional digits in the number.ExamplesThe following examples show how the different formatting designations can affect thebehavior of $FNUMBER. These examples assume that the current locale is the default locale.The following example returns +124329; $FNUMBER forces a plus sign on the value of Abecause A is non-negative:SET A=124329WRITE $FNUMBER(A,"+")The following example returns 30.567; $FNUMBER removes the negative sign from thevalue of B.SET B=-30.567WRITE $FNUMBER(B,"-")The following example returns 1,234,567.81; $FNUMBER inserts a comma every 3numerals to the left of the decimal point of C.SET C=1234567.81WRITE $FNUMBER(C,",")The following example returns 1.234.567,81; $FNUMBER inserts European formatting toC.SET D=1234567.81WRITE $FNUMBER(D,".")The following example returns 124,329.00; $FNUMBER inserts a comma and adds a decimalpoint and two zeros to the value of C.SET C=124329WRITE $FNUMBER(C,",",2)$FNUMBERThe following example shows how $FNUMBER inserts the trailing character after variables:<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 215

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!