
// 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:
You can also use this condition in a Form Validation if saving using cursor forms.
Link this expression to a Save button such that the user input validation will be executed before the database save.
// Use intID for unique primary key values.
intID = intID + 1
intID = Number.ToInteger(intID)
Note:
Results from a mathematical operation is always a double data type thus it is good practice to always convert the result back to integer especially if that value is be saved to an integer column.
You can also use ToDouble or ToBoolean, depending on the column data types.