Lasso Soft Inc. > Home

[Decimal->SetFormat]

[Decimal->SetFormat] specifies the format in which the decimal value will be output when cast to string or displayed to a visitor.

Options include specifying the character that will be used for the decimal point or thousands group separator, forcing the decimal to display in scientific notation, and options for padding the output.

  • Syntax
  • Parameters
[Decimal Value->(SetFormat:
  -DecimalChar=Decimal Point Character,
  -GroupChar=Thousands Separator Character,
  -Precision=Number of Characters Precision,
  -Scientific=Boolean,
  -Padding=Number of Characters to Pad Output,
  -PadChar=Padding Character,
  -PadRight=Boolean]
Required Parameters
Decimal Variable The base decimal variable which will be formatted.
Optional Parameters
-Precision Specifies the desired number of characters of precision. By default values are output with 6 characters of precision.
-DecimalChar Specifies the desired character to use as a decimal point. Defaults to a period.
-GroupChar Specifies the desired character to use for thousands grouping. Defaults to the empty string so thousands grouping is not performed.
-Padding Specifies the desired width in character of the output.
-PadChar Specifies the character to use to pad the output. Defaults to a space.
-PadRight If set to True the output will be padded on the right. By default the output will be padded on the left.
-Scientific If set to True, the output will be in scientific notation. By default, scientific notation will only be used if required.
Examples

To display a dollar amount:

Use the [Decimal->SetFormat] tag to set the precision of the value to 2 decimal places. Thousands grouping can be activated by setting -GroupChar to a comma.

[Variable: 'Dollar_Amount'=(Decimal:'1000000.0')]
[$Dollar_Amount->(SetFormat: -Precision=2, -GroupChar=',')]
$[Variable: 'Dollar_Amount']
Result:
$1,000,000.00
Tag Link [Decimal->SetFormat] Category Math
Type Member Data Source Any
Support Preferred Version 5.0
Output Type None Security None
Implementation LCAPI Sets Lasso 7.0, Lasso 6.0, Lasso 5.0

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft