$AlphNum: Difference between revisions
No edit summary |
|||
Line 1: | Line 1: | ||
<p>The $ | <p>The $Alphnum function verifies whether a string is composed only of characters which are valid in the specified (or default) language, and digits 0 through 9. A 1 is returned if the condition is true; otherwise, a 0 is returned (for a false condition). A 0 is returned if there are any spaces or punctuation marks in the string, or if the string is null. </p> | ||
<b>Syntax</b> | <b>Syntax</b> | ||
<p class="code">$ | <p class="code">$Alphnum(<var class="term">string</var>[,<var class="term">language</var>]) | ||
</p> | </p> | ||
<p>where:</p> | <p>where:</p> | ||
Line 31: | Line 31: | ||
<tr> | <tr> | ||
<td> | <td> | ||
<p class="code"><var>$ | <p class="code"><var>$alphnum ('JOHN','US')</var> | ||
</p></td> | </p></td> | ||
<td align="right"><var>1</var></td> | <td align="right"><var>1</var></td> | ||
Line 37: | Line 37: | ||
<tr> | <tr> | ||
<td> | <td> | ||
<p class="code"><var>$ | <p class="code"><var>$alphnum ('M�CON','FRENCHC')</var> | ||
</p></td> | </p></td> | ||
<td align="right"><var>1</var></td> | <td align="right"><var>1</var></td> | ||
Line 43: | Line 43: | ||
<tr> | <tr> | ||
<td> | <td> | ||
<p class="code"><var>$ | <p class="code"><var>$alphnum ('M�CON','US')</var> | ||
</p></td> | </p></td> | ||
<td align="right">0</td> | <td align="right">0</td> | ||
Line 49: | Line 49: | ||
<tr> | <tr> | ||
<td> | <td> | ||
<p class="code"><var>$ | <p class="code"><var>$alphnum ('JOHN SMITH','US')</var> | ||
</p></td> | </p></td> | ||
<td align="right"><var>0</var></td> | <td align="right"><var>0</var></td> | ||
Line 55: | Line 55: | ||
<tr> | <tr> | ||
<td> | <td> | ||
<p class="code"><var>$ | <p class="code"><var>$alphnum ('�LE D'ORL�ANS','FRENCHC')</var> | ||
</p></td> | </p></td> | ||
<td align="right"><var>0</var></td> | <td align="right"><var>0</var></td> | ||
Line 61: | Line 61: | ||
<tr> | <tr> | ||
<td> | <td> | ||
<p class="code"><var>$ | <p class="code"><var>$alphnum ('12A','US')</var> | ||
</p></td> | </p></td> | ||
<td align="right"><var>1</var></td> | <td align="right"><var>1</var></td> | ||
Line 67: | Line 67: | ||
<tr> | <tr> | ||
<td> | <td> | ||
<p class="code"><var>$ | <p class="code"><var>$alphnum ('12A','FRENCHC')</var> | ||
</p></td> | </p></td> | ||
<td align="right"><var>1</var></td> | <td align="right"><var>1</var></td> | ||
</tr> | </tr> | ||
</table> | </table> | ||
<p>In the following example, the request sorts by name and processes records whose designated field value does not meet the $ | <p>In the following example, the request sorts by name and processes records whose designated field value does not meet the $Alphnum criteria. The second argument in the $Alphnum call instructs <var class="product">Model 204</var> to use French Canadian to perform the validation:</p> | ||
<p class="code">BEGIN | <p class="code">BEGIN | ||
%SEARCH = $READ('ENTER FIELD NAME') | %SEARCH = $READ('ENTER FIELD NAME') | ||
Line 80: | Line 80: | ||
PLACE RECORDS IN FIND.RECS ON LIST BAD | PLACE RECORDS IN FIND.RECS ON LIST BAD | ||
FOR EACH RECORD IN FIND.RECS | FOR EACH RECORD IN FIND.RECS | ||
IF $ | IF $alphnum(%%SEARCH,'FRENCHC') THEN | ||
REMOVE RECORD FROM LIST BAD | REMOVE RECORD FROM LIST BAD | ||
END IF | END IF | ||
Line 91: | Line 91: | ||
END | END | ||
</p> | </p> | ||
<p class="note"><b>Note:</b> For upward compatibility reasons, $ | <p class="note"><b>Note:</b> For upward compatibility reasons, $Alpha and $Alphnum do not recognize lowercase English letters as alphabetic characters unless a non-null language parameter is specified.</p> | ||
[[Category:SOUL $functions]] | [[Category:SOUL $functions]] |
Revision as of 12:15, 7 July 2014
The $Alphnum function verifies whether a string is composed only of characters which are valid in the specified (or default) language, and digits 0 through 9. A 1 is returned if the condition is true; otherwise, a 0 is returned (for a false condition). A 0 is returned if there are any spaces or punctuation marks in the string, or if the string is null.
Syntax
$Alphnum(string[,language])
where:
The string argument represents the characters to verify, which must be one of the following:
- A string of characters enclosed in quotation marks.
- A %variable.
- A field name that is not enclosed in quotation marks. In this case, the function call must be embedded in a FOR EACH RECORD loop where the current value of the field is verified.
The optional language argument specifies the language to use. The language argument is handled as follows:
- When the language argument is omitted, Model 204 performs the validation in U.S. English, even if the value of the LANGUSER parameter is not US, and lowercase characters are not recognized.
- An asterisk enclosed in quotation marks ('*') instructs Model 204 to use the value of the LANGUSER parameter.
- You can enter the name of a valid language enclosed in quotation marks or a %variable containing a valid language. If the value you enter is not supported, the request is canceled with an error message. See The LANGUSER parameter in the Rocket Model 204 Parameter and Command Reference Manual for the valid values.
Examples
The following example illustrates the string and language arguments as literals enclosed in quotation marks:
Function code... | Returns... |
---|---|
$alphnum ('JOHN','US') |
1 |
$alphnum ('M�CON','FRENCHC') |
1 |
$alphnum ('M�CON','US') |
0 |
$alphnum ('JOHN SMITH','US') |
0 |
$alphnum ('�LE D'ORL�ANS','FRENCHC') |
0 |
$alphnum ('12A','US') |
1 |
$alphnum ('12A','FRENCHC') |
1 |
In the following example, the request sorts by name and processes records whose designated field value does not meet the $Alphnum criteria. The second argument in the $Alphnum call instructs Model 204 to use French Canadian to perform the validation:
BEGIN %SEARCH = $READ('ENTER FIELD NAME') FIND.RECS: FIND ALL RECORDS FOR WHICH RECTYPE = POLICYHOLDER END FIND PLACE RECORDS IN FIND.RECS ON LIST BAD FOR EACH RECORD IN FIND.RECS IF $alphnum(%%SEARCH,'FRENCHC') THEN REMOVE RECORD FROM LIST BAD END IF END FOR SORT.RECS: SORT RECORDS ON LIST BAD BY FULLNAME FOR EACH RECORD IN SORT.RECS . . . END
Note: For upward compatibility reasons, $Alpha and $Alphnum do not recognize lowercase English letters as alphabetic characters unless a non-null language parameter is specified.