11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

the end of width. If the expression value itself is less than 1, $JUSTIFY inserts a leadingzero before the decimal point. Note that decimal also causes $JUSTIFY to round theexpression value to fit the number of decimal positions.The decimal parameter is meaningful only if the expression evaluates to a number. Ifexpression evaluates to a string, $JUSTIFY replaces it with a string of zeroes starting at thedecimal position up to the end of width. Unlike string values, the $DOUBLE values INF, -INF, and NAN are returned unchanged by $JUSTIFY, regardless of the decimal value.ExamplesAssume the following variables var1=250.50 and var2=875.00. These commands:SET var1=250.50,var2= 875.00WRITE !,$JUSTIFY(var1,20,2),!,$JUSTIFY(var2,20,2)WRITE !,$JUSTIFY("_________",20)WRITE !,$JUSTIFY("TOTAL",9),$JUSTIFY(var1+var2,11,2)return the following lines:250.50875.00_______TOTAL 1125.50The starting position for width is determined by the current $X value.If this code had omitted the decimal option for the output numbers, the lines would appearas follows:250.5875_______TOTAL 1125.50See Also• $FNUMBER function• $X special variable$JUSTIFY<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 237

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

Saved successfully!

Ooh no, something went wrong!