Finding patterns in codes

You can find patterns in the code that is used for Optiva Workflows.

Use the Visual Basic .NET function, inStr, to find a string pattern in an object code. If the code meets a specific format, another operation can be performed on it.

This example finds two codes. The first one has a character in the seventh position from the left. The second one finds a dash in the seventh position in the code.


Dim formCode, char6, dashStr As String
' First example. Look for numerics in first 6 positions in a code
' Current code is hard-coded.

 formCode = "123456P.4567"
 If isNumeric(left(formCode, 6)) then
 MessageList("1st 6 characters of formula code are numeric with or without a decimal.")
 end if

' Looking for a character at the 7th position
 if not isNumeric(Mid(formCode, 7, 1)) then
 MessageList ("7th character of the formula code is a letter or non-numeric character such as comma or asterisk.")
 end if