Number Examples

Example 1. Use IsDouble and IsInteger methods to validate user input.

// Check if integer

IF strDataType == "Integer" AND Number.IsInteger(edtNewValue) == false AND edtNewValue <> ""

{

    // Display error message and dont allow to save

    Form.MessageBox("Invalid Input", "Please enter an integer value.", MB_ICONERROR)

    EXIT

}

// Check if double

IF strDataType == "Double" AND Number.IsDouble(edtNewValue) == false AND edtNewValue <> ""

{

    // Display error message and dont allow to save

    Form.MessageBox("Invalid Input", "Please enter a double value.", MB_ICONERROR)

    EXIT

}

// put Save code here.

Note:

Example 2. Use ToInteger method to format a control or variable after mathematical operations.

// Use intID for unique primary key values.

intID = intID + 1

intID = Number.ToInteger(intID)

Note: