Logical Formatters
Version 24.2.9039
Version 24.2.9039
- allownull()
- contains(target[, ifcontains][, ifnotcontains])
- def(ifnotexists[, ifexists])
- empty(value)
- equals(value[, ifequal][, ifnotequal])
- ifequal(value[, ifequals][, ifnotequals])
- ifmatches(value[, ifmatch][, ifnotmatch])
- isalphabetic([ifalpha][, ifnotalpha])
- isalphanumeric([ifalphanum][, ifnotalphanum])
- islower([iflower][, ifnotlower])
- isnumeric([ifnum][, ifnotnum])
- isspace([ifspace][, ifnotspace])
- isupper([ifupper][, ifnotupper])
- notequals(value[, notequals][, equals])
- startswith(target[, iftrue][, iffalse])
Logical Formatters
allownull()
Returns NULL if the attribute does not exist or the value if it does.
contains(target[, ifcontains][, ifnotcontains])
Returns true if the input string contains the target, and false otherwise.
You can set the ifcontains parameter to an alternate value to return if the input string contains the target, and you can set the ifnotcontains parameter to an alternate value to return if the input string does not contain the target.
Example
<arc:set attr="myString" value="hello world" />
<arc:if exp="[myString | contains('hello')]">
<arc:set attr="response" value="hello to you too!" />
<arc:else>
<arc:set attr="response" value="I would appreciate a greeting" />
</arc:else>
</arc:if>
def(ifnotexists[, ifexists])
Sets the ‘default’ value of an attribute. If the attribute has not yet been set to a value, set it to the value passed in ifnotexists; if the attribute already exists, set it to the value passed in ifexists.
Example
<!-- count the number of loops in an XML document using xmlDOMSearch -->
<arc:set attr="xml.uri" value="[FilePath]" />
<arc:set attr="xml.xpath" value="/Items/test/loop" />
<arc:call op="xmlDOMSearch" in="xml">
<!-- this code executes for each occurrence of the 'xpath' in the XML document -->
<arc:set attr="loopCount" value="[loopCount | def(0) | add(1)]" />
</arc:call>
empty(value)
Returns the specified value if the attribute value is empty; otherwise the original attribute value.
- value: The value to use if the attribute is empty.
equals(value[, ifequal][, ifnotequal])
Returns true if the input attribute matches the value, and false otherwise.
If ifequal and/or ifnotequal are provided, the values in these parameters are returned instead of true and false.
Example
<arc:set attr="myItem.code" value="[xpath(data/lineitems/itemcode)]" />
<arc:if exp="[myItem.code | equals('A5')]">
<arc:set attr="myItem.name" value="spoon" />
<arc:else>
<arc:set attr="myItem.name" value="fork" />
</arc:else>
</arc:if>
ifequal(value[, ifequals][, ifnotequals])
Compares the attribute value with the first parameter value and returns true (or ifequals) if they are equal and false (or ifnotequals) if they are not.
- value: The string to compare with the attribute value.
- ifequals: The optional value returned if the attribute value equals the value represented by the first parameter.
- ifnotequals: The optional value returned if the attribute value does not equal the value represented by the first parameter.
ifmatches(value[, ifmatch][, ifnotmatch])
Returns true (or ifmatch) if the attribute value matches the first parameter, otherwise false (or ifnotmatch).
- value: The value to compare with the attribute value.
- ifmatch: The optional value returned if the attribute value matches the parameter value.
- ifnotmatch: The optional value returned if the attribute value does not match the parameter value.
isalphabetic([ifalpha][, ifnotalpha])
Returns true (or ifalpha) if all characters in the attribute value are alphabetic and there is at least one character, and false (or ifnotalpha) otherwise.
- ifalpha: The optional value returned if the attribute value is alphabetic.
- ifnotalpha: The optional value returned if the attribute value is not alphabetic.
isalphanumeric([ifalphanum][, ifnotalphanum])
Returns true (or ifalphanum) if all characters in the attribute value are alphanumeric and there is at least one character, and false (or ifnotalphanum) otherwise.
- ifalphanum: The optional value returned if the attribute value contains only alphabetic or numeric characters.
- ifnotalphanum: The optional value returned if the attribute value contains nonalphabetic or nonnumeric characters.
islower([iflower][, ifnotlower])
Returns true (or iflower) if all letters in the attribute value are lowercase and there is at least one character that is a letter, and false (or ifnotlower) otherwise.
- iflower: The optional value returned if the attribute value is lowercase.
- ifnotlower: The optional value returned if the attribute value is not lowercase.
isnumeric([ifnum][, ifnotnum])
Returns true (or ifnum) if all characters in the attribute value are digits and there is at least one character, and false (or ifnotnum) otherwise.
- ifnum: The optional value returned if the attribute value is numeric.
- ifnotnum: The optional value returned if the attribute value is not numeric.
isspace([ifspace][, ifnotspace])
Returns true (or ifspace) if there are only white-space characters in the attribute value and there is at least one character, and false (or ifnotspace) otherwise.
- ifspace: The optional value returned if the attribute value is a space.
- ifnotspace: The optional value returned if the attribute value is not a space.
isupper([ifupper][, ifnotupper])
Returns true (or ifupper) if all letters in the attribute value are uppercase and there is at least one character that is a letter, and false (or ifnotupper) otherwise.
- ifupper: The optional value returned if the attribute value is uppercase.
- ifnotupper: The optional value returned if the attribute value is not uppercase.
notequals(value[, notequals][, equals])
Compares the attribute value with the first parameter value. Returns true (or notequals) if they are not equal, and false (or equals) if they are.
- value: The string to compare with the attribute value.
- notequals: The optional value returned if the attribute value does not equal the value represented by the first parameter.
- equals: The optional value returned if the attribute value equals the value represented by the first parameter.
startswith(target[, iftrue][, iffalse])
Returns true if the input string starts with the value specified as the target, and false otherwise.
If iftrue is provided, this value is returned instead of true when the target is found, and if iffalse is provided, this value is returned instead of false when the target is not found.
Example
<arc:set attr="myString" value="Sir, your carriage is ready." />
<arc:if exp="[myString | startswith('Sir')"]>
<arc:set attr="response" value="Thank you." />
<arc:else>
<arc:set attr="response" value="Use your manners." />
</arc:else>
</arc:if>