$Web Sels Check: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:$Web_Sels_Check}} <span class="pageSubtitle"><section begin="desc" />Check string against a delimited list of strings<section end="desc" /></span> $Web_Sels_Che...")
 
 
(18 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:$Web_Sels_Check}}
{{DISPLAYTITLE:$Web_Sels_Check}}
<span class="pageSubtitle"><section begin="desc" />Check string against a delimited list of strings<section end="desc" /></span>
<span class="pageSubtitle">Check string against a delimited list of strings</span>


<var>$Web_Sels_Check</var> validates that a string matches one of a delimited list of strings. Note that although this is provided for a sort of symmetry in the $Web_Sel* functions, it is somewhat unnecessary; a simple <var>$Oneof</var> could do basically the same thing. An overview of the $Web_Sel* functions is provided in <var>[[$Web_Selp]]</var>.


<var>$Web_Sels_Check</var> takes three arguments and returns a numeric result code; for some types of errors, the current <var class="product">User Language</var> request is cancelled.


$Web_Sels_Check validates that a string matches one of a delimited list of strings. Note that although this is provided for a sort of symmetry in the $WEB_SELx functions, it is somewhat unnecessary; a simple $ONEOF could do basically the same thing. An overview of the $WEB_SEL_x functions is provided in [[$Web_Selp]].
$Web_Sels_Check takes three arguments and returns a numeric result code; for some types of errors, the current User Language request is cancelled.
==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /> %RC = $Web_Sels_Check(delimited_strings, selected_value, -
<p class="syntax"><span class="term">%rc</span> = <span class="literal">$Web_Sels_Check</span>(<span class="term">delimited_strings</span>, [<span class="term">selected_value</span>], [<span class="term">option_keywords</span>])
option_keywords)
</p>
<section end="syntax" /></p>
 
 


<table class="syntaxTable">
===Syntax terms===
<table>
<tr><th>delimited_strings</th>
<tr><th>delimited_strings</th>
<td>A string containing a delimited list of strings which are used to check the string. The first character of this argument is the delimiter that separates the values. The string should not contain a trailing delimiter unless one of the values is the null string, which is unlikely, at least when used with select option lists. This is a required argument.</td></tr>


<td>A string containing a delimited list of strings which are used to check the string. The first character of this argument is the delimiter that separates the values. The string should not contain a trailing delimiter unless one of the values is the null string, which is unlikely, at least when used with select option lists. This is a required argument.</td></tr>
<tr><th>selected_value</th>
<tr><th>selected_value</th>
 
<td>This optional argument is a string which is checked to see if it is equal to one of the delimited strings. This a required argument.</td></tr>
 
<td>A string which is checked to see if it is equal to one of the delimited strings. This a required argument.</td></tr>
<tr><th>option_keywords</th>
<tr><th>option_keywords</th>
 
<td>A string of blank-separated keywords specifying special processing for this $function; it can contain any of the following:<table class="syntaxTable">
<table class="syntaxTable">
<tr><th><var>CANCHECK</var></th>
<td>A string of blank-separated keywords specifying special processing for this $function; it can contain any of the following:</td></tr>
<tr><th>CANCHECK</th>
<td>Cancel request if ''selected_value'' not equal to any of the delimited strings
<td>Cancel request if ''selected_value'' not equal to any of the delimited strings
</td></tr></table>
</td></tr></table>
This an optional argument.
</td></tr></table>
</td></tr></table>


<table class="syntaxTable">
===Return codes===
<table>
<tr><th>Code</th>
<tr><th>Code</th>
<td>Meaning</td></tr>
<th>Meaning</th></tr>
<tr><th>0</th>
 
<td>''Selected_value'' equal to one of the delimited strings.</td></tr>
<tr><td>0</td>
<tr><th>2</th>
<td><var class="term">selected_value</var> equal to one of the delimited strings.</td></tr>
<td>''Selected_value'' not equal to any of the delimited strings,</td>
and CANCHECK option not specified.<tr><th></th>
<td>Any other error results in cancellation of the User Language request.</td></tr>


<tr><td>2</td>
<td><var class="term">selected_value</var> not equal to any of the delimited strings, and <var>CANCHECK</var> option not specified.</td></tr>
<tr><th></th>
<td>Any other error results in cancellation of the <var class="product">User Language</var> request.</td></tr>
</table>
</table>
<p class="caption">$WEB_SELS_CHECK return codes</p>


For example, the following statement will cancel the User Language request if the value of variable <tt>%SEL</tt> is not one of the strings<tt>DN0</tt>, <tt>DN1</tt>, etc.:
==Examples==
<ol>
<li>The following statement will cancel the <var class="product">User Language</var> request if the value of variable <tt>%SEL</tt> is not one of the strings<tt>DN0</tt>, <tt>DN1</tt>, etc.:
<p class="code"> %RC = $Web_Sels_Check('/DN0/DN1/DN2/DN3/DN4' -
<p class="code"> %RC = $Web_Sels_Check('/DN0/DN1/DN2/DN3/DN4' -
  WITH '/DN5/DN6', %SEL, 'CANCHECK')
  WITH '/DN5/DN6', %SEL, 'CANCHECK')
</p>
</p>


 
<li>See <var>[[$Web_Selp]]</var> for an extended example using other $Web_Sel* functions.
See [[$Web_Selp]] for an extended example using other $WEB_SELx functions.
</ol>


[[Category:Janus Web Server $functions|$Web_Sels_Check]]
[[Category:Janus Web Server $functions|$Web_Sels_Check]]

Latest revision as of 17:15, 16 April 2013

Check string against a delimited list of strings

$Web_Sels_Check validates that a string matches one of a delimited list of strings. Note that although this is provided for a sort of symmetry in the $Web_Sel* functions, it is somewhat unnecessary; a simple $Oneof could do basically the same thing. An overview of the $Web_Sel* functions is provided in $Web_Selp.

$Web_Sels_Check takes three arguments and returns a numeric result code; for some types of errors, the current User Language request is cancelled.

Syntax

%rc = $Web_Sels_Check(delimited_strings, [selected_value], [option_keywords])

Syntax terms

delimited_strings A string containing a delimited list of strings which are used to check the string. The first character of this argument is the delimiter that separates the values. The string should not contain a trailing delimiter unless one of the values is the null string, which is unlikely, at least when used with select option lists. This is a required argument.
selected_value This optional argument is a string which is checked to see if it is equal to one of the delimited strings. This a required argument.
option_keywords A string of blank-separated keywords specifying special processing for this $function; it can contain any of the following:
CANCHECK Cancel request if selected_value not equal to any of the delimited strings

Return codes

Code Meaning
0 selected_value equal to one of the delimited strings.
2 selected_value not equal to any of the delimited strings, and CANCHECK option not specified.
Any other error results in cancellation of the User Language request.

Examples

  1. The following statement will cancel the User Language request if the value of variable %SEL is not one of the stringsDN0, DN1, etc.:

    %RC = $Web_Sels_Check('/DN0/DN1/DN2/DN3/DN4' - WITH '/DN5/DN6', %SEL, 'CANCHECK')

  2. See $Web_Selp for an extended example using other $Web_Sel* functions.