GetFormattedNumber

Formats a number by applying characteristics such as scaling and delimiters.

Syntax

<HFMwData>.GetFormattedNumber dNumber, lNumDecimals, bstrDecimalCharacter, bstrThousandsCharacter, sScale, bRemoveTrailingZeroes, pbstrFormattedNumber

Argument

Description

dNumber

The number to be formatted.

Input argument. Double subtype.

lNumDecimals

Specifies the number of decimal places to be included in the formatted number.

Input argument. Long subtype.

bstrDecimalCharacter

Specifies the decimal separator character to be used in the formatted number.

Tip:

To apply the application’s default decimal separator, use the HFMwSession component’s decimalSeparator property.

Input argument. String subtype.

bstrThousandsCharacter

Specifies the thousands separator character to be used in the formatted number.

Tip:

To apply the application’s default thousands separator, use the HFMwSession component’s thousandsSeparator property.

Input argument. String subtype.

sScale

Specifies the degree of scaling to apply to the formatted number. Scaling works as described in the following list:

  • To leave the return value unscaled, pass 0.

  • To scale the return value, each whole-number increment over 0 scales by a tenth, and each whole-number increment less than 0 scales by ten. In other words, passing 1 scales by a tenth, passing 2 scales by a hundredth, passing -1 scales by ten, passing -2 scales by one hundred, and so on.

Input argument. Integer subtype.

bRemoveTrailingZeroes

Determines whether trailing zeroes will be stripped from the decimal segment of the formatted number. Pass TRUE to strip trailing zeroes, FALSE otherwise.

Input argument.

pbstrFormattedNumber

Returns the formatted number.

Output argument.

Example

The following function scales a number by a thousandth and applies the application’s default decimal and thousands separators to the formatted number.

Function ScaleToThousandths(dNum)
Dim cHFMData, sNum
Set cHFMData = Server.CreateObject("Hyperion.HFMwData")
' cHFMSession is a previously set HFMwSession object
cHFMData.SetWebSession cHFMSession
cHFMData.GetFormattedNumber dNum, 0, _
  cHFMSession.decimalSeparator, _ 
  cHFMSession.thousandsSeparator, 3, TRUE, sRetVal
ScaleToThousandths = sRetVal
End Function