18. Working with Data Types and Data Display Formats : String Input Templates : String Template Creation : Custom Character Sets
 
Share this page                  
Custom Character Sets
In some instances, you may want to limit a user's entries to some set of characters that are broader or narrower than those available using the pre‑defined special characters. To accommodate these needs, you can define up to 12 custom character sets per template. If the set you want is small--for example, one or two characters--you can use the following syntax:
[c{c}]
The c represents the valid character or characters. You can include any number of valid characters. Simply use this syntax in the template in the positions where you want the specified characters. You must include the brackets. For example, the following template allows the user to enter only the letters a, b, or c in the first position:
[abc]nnn
If you want to specify a range of characters, use the following syntax:
[c‑c2]
The c represents the beginning character in the range and c2 represents the ending character.
For either syntax, the user must enter one of the specified characters in the specified position.
In either syntax version, the case of the characters is unimportant for alphabetic characters. You can use an uppercase or lowercase character to represent the character. To force the user's entry to either case, use the special formatting character that specifies forced case. For more information, see How to Specify Uppercase or Lowercase (see page How to Specify Uppercase or Lowercase) .
When defining a character set for a single position in this manner, you cannot enforce mandatory entry in that position. To enforce mandatory entry, you must define the character set with a user‑defined special character.
If you are defining a large character set or are using the set in several places in your custom template, it is probably more convenient to define a special character to represent the set and use that character in the template. For more information, see User-defined Characters (see page User-defined Characters).