Skip to content

CreateNumericMask - cCJGridColumn

Provides a quick mechanism for creating a numeric column with a mask based on the number of digits passed

Type: Procedure

Parameters

Parameter Type Description
iLeft Integer Number of digits to the left of the decimal separator
iRight Integer Number of digits to the right of the decimal separator

Syntax

Procedure CreateNumericMask Integer iLeft Integer iRight

Call Example

Send CreateNumericMask iLeft iRight

Description

CreateNumericMask provides a quick way to create a numeric column. You pass it the allowed digits to the right and left of the decimal separator and it sets the data type and a mask based on the default system mask.

It sets the peDataType property to Mask_Numeric_Window.

It sets the psMask value by creating a mask based on the digits passed and the default mask format defined by the global Default_Numeric_Mask string. This creates a numeric mask, which uses the appropriate regional settings with the appropriate number of digits.

Data aware grid columns (cDbCJGridColumn) are usually assigned their data type and mask based on their data dictionaries and their data binding (piBindingTable, piBindingColumn). Non data aware grid columns and any columns that are not bound to a data dictionary (e.g. calculated columns) must have their data type and mask manually assigned. CreateNumericMask provides an easy way to define numeric columns.

Object oDiscount is a cDbCJGridColumn
    Send CreateNumericMask 4 2
    Set pbFocusable to False
    Set piWidth to 75
    Set psCaption to "Percent"

    Procedure OnSetCalculatedValue String ByRef sValue
        Move (Invt.Disount * 100) to sValue
    End_Procedure
End_Object

Currency masks may be created using CreateCurrencyMask.

If you need to create custom masks you may do so by directly setting peDataType and psMask. The global functions Number_Default_Mask and Field_Number_Default_Mask may be used to create customized numeric and currency masks.

Note that this is a procedure and that it sets the peDataType, psMask and piMaxLength properties. Since this will change existing property values and these property values can be changed after the message, the placement of this matters.