System.Format(Any [, Integer] [, Integer]) Method

Version: Available or changed with runtime version 1.0.

Formats a value into a string.

Syntax

String :=   System.Format(Value: Any [, Length: Integer] [, FormatNumber: Integer])

Note

This method can be invoked without specifying the data type name.

Parameters

Value
 Type: Any
This is an AL variable (expression) of any simple data type, such as Option, Integer, BigInteger, Decimal, Char, Text, Code, Date, Time, DateTime, Boolean, or GUID. If, when the system formats Value, the result is a value larger than the maximum length MAXSTRLEN method (Code, Text) of String, a run-time error occurs.

[Optional] Length
 Type: Integer
This optional parameter specifies the length of String.

[Optional] FormatNumber
 Type: Integer
This optional parameter specifies the format that you want to use.

Return Value

String
 Type: Text

Remarks

The FormatNumber parameter specifies the format that you want to use. The basic options for the Decimal data type are as follows:

  • <Sign><Integer Thousand><Decimals> is Format 0
  • <Sign><Integer><Decimals> is Format 1
  • <Sign><Integer><Decimals><Comma,.> is Format 2
  • <Integer Thousand><Decimals><Sign,1> is Format 3
  • <Integer><Decimals><Sign,1> is Format 4

For more information, see Formatting Values, Dates, and Time).

System Data Type
Get started with AL
Developing extensions