Formatting

In addition to the standard formatters, you can define script formatters. These formatters are displayed as objects in the project script and fire an event that lets you format the text of a field. There are three formatter types: Date, Double, and Text. Depending on the formatter type, a different event is fired.


A visual example of the Script Formatter Event.

Example part 1

Private Sub MyFormatter_FormatField(ByVal FieldText As String, FormattedText As String, ErrDescription As String, ValidFormat As Boolean)

The FieldText parameter is the field text before the formatting is applied. The FormattedText parameter contains the formatted text. Use the ErrorDescription parameter to define a message that is displayed to the user in Validation if there is an issue. Set the ValidFormat flag to indicate the outcome of the script formatting.

Example part 2

Private Sub Formatting_FormatDoubleField(ByVal FieldText As String, FormattedText As String, ErrDescription As String, ValidFormat As Boolean, ByRef DoubleVal As Double, ByRef DoubleFormatted As Boolean)

In addition to the parameters used in example part 1, example part 2 also includes the DateVal parameter. This parameter contains the date value of the field if the date formatting is successful. It also includes the DateFormatted flag that indicates if the DateVal is set.

Examples part 3

Private Sub Formatting_FormatDateField(ByVal FieldText As String, FormattedText As String, ErrDescription As String, ValidFormat As Boolean, ByRef DateVal As Date, ByRef DateFormatted As Boolean)

In addition to the parameters used in example part 1 and part 2, example part 3 also includes the DoubleVal parameter that contains the double value of the field if the date formatting is successful. The DoubleFormatted flag indicates when the DoubleVal parameter is set.