User Guide : Scripting : Using Scripts to Perform Specific Tasks : Handling Invalid Data
 
Share this page             
Handling Invalid Data
You must validate the data before any actions (that results in an output) are performed.
Validation statements can vary depending on your source and target data types, and the rules you want to apply.
Validation Examples
If you have a target field named "Account No" that must be numeric and five bytes in length, your data validation statement is:
If IsNumeric(FieldAt("/SOURCE/R1/Account No")) Then
  If Len(Trim(FieldAt("/SOURCE/R1/Account No"))) <> 5 Then
    Reject()
  Else
    Val(FieldAt("/SOURCE/R1/Account No"))
  End If
Else
  Reject()
End If
Or, if you want to be certain that the incoming field is not blank, and notify the user of a blank field, your validation statement is:
If IsNull(FieldAt("/SOURCE/R1/State")) Then
  LogMessage("Info","Target field 'State' must contain a value.")
  Terminate()
End If
Or, if you want to process only records from customers in Texas, your validation statement is:
If FieldAt("/SOURCE/R1/State") <> "TX" Then
  Reject()
End If