IsValidFormat

The IsValidFormat function compares the format of the string in parameter 1 to the format definition in parameter 2 and returns whether the string in parameter 1 is in the correct format or not.

This function supports the same formats as the content validation format check. All of the formats except for format C are available. For more information about the format types, see Format check.

If you want to use the same format in multiple places, you can store it in a data field and pass the data field to this function in parameter 2.

Return type

The function return type is: BOOLEAN

Function parameters

Table 1. IsValidFormat assignment function parameters
Parameter order Input variable type Parameter data type Required parameter Description
1 Data field STRING Yes The data field to be checked whether it has a valid format or not.
2 Valid types are:
  • Data field
  • Constant
STRING Yes A string, or the name of a data field, that has the format to use to validate the data field in parameter 1.

Examples

The following XML shows an example of using the IsValidFormat function in an assignment element.
<assignment field="refIsValidRT1" type="IsValidFormat" value="ibmNprRT, 'TTTTAAAAC'"/>
In this example, the IsValidFormat is called to return whether the value in the ibmNprRT field is in the routing number with check digit format or not.
The following XML shows an example of storing a format definition in a data field and then using it in the IsValidFormat function of an assignment element.
<assignment field="refRtFormat"    type="string"         value="TTTTAAAAC"/>
<assignment field="refIsValidRT2"  type="IsValidFormat"  value="ibmNprRT, refRtFormat"/>
The format definition is stored in the refRtFormat field, which is then used to check whether the ibmNprRT field is in the correct format or not.