Difference between revisions of "EPScript/Operators"
m (Reverted edit of DovQbl, changed back to last version by Tom) |
(Added format template) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | {{formats}} | ||
+ | |||
{{EPScript}} | {{EPScript}} | ||
Line 6: | Line 8: | ||
===and=== | ===and=== | ||
− | |||
Returns true if both the left-hand and the right-hand expressions return true. | Returns true if both the left-hand and the right-hand expressions return true. | ||
− | + | {{codesample|<pre> | |
− | {{codesample| | ||
− | <pre> | ||
<if test="type = 'book' and is_set( creators )"> | <if test="type = 'book' and is_set( creators )"> | ||
... | ... | ||
</if> | </if> | ||
− | </pre> | + | </pre>}} |
− | }} | ||
===or=== | ===or=== | ||
Returns true if at least one of the expressions returns true. | Returns true if at least one of the expressions returns true. | ||
− | {{codesample| | + | {{codesample| <pre> |
<if test="type = 'book' or type = 'patent'"> | <if test="type = 'book' or type = 'patent'"> | ||
... | ... | ||
</if> | </if> | ||
− | }} | + | </pre>}} |
===not=== | ===not=== | ||
Returns true if the expression is false and false if the expression is true. | Returns true if the expression is false and false if the expression is true. | ||
+ | {{codesample|<pre> | ||
<if test="!is_set( creators )"> | <if test="!is_set( creators )"> | ||
− | + | ... | |
− | + | </if> | |
+ | </pre>}} | ||
==Comparison Operators== | ==Comparison Operators== | ||
===lt=== | ===lt=== | ||
− | |||
Returns true if the left-hand expression is less than the right-hand expression. This is only applicable to expressions that return numeric values. | Returns true if the left-hand expression is less than the right-hand expression. This is only applicable to expressions that return numeric values. | ||
− | + | {{codesample|<pre> | |
− | {{codesample| | + | <if test="length(editors) lt 6"> |
− | <pre> | + | ... |
− | <if test="length(editors) lt 6"> | + | </if> |
− | ... | + | </pre>}} |
− | </if> | ||
− | </pre> | ||
− | }} | ||
===gt=== | ===gt=== | ||
− | |||
Returns true if the left-hand expression is greater than the right-hand expression. This is only applicable to expressions that return numeric values. | Returns true if the left-hand expression is greater than the right-hand expression. This is only applicable to expressions that return numeric values. | ||
− | + | {{codesample|<pre> | |
− | {{codesample| | + | <if test="length(editors) gt 1"> |
− | <pre> | + | ... |
− | <if test="length(editors) gt 1"> | + | </if> |
− | ... | + | </pre>}} |
− | </if> | ||
− | </pre> | ||
− | }} | ||
===equals=== | ===equals=== | ||
− | |||
Returns true if the left-hand expression is equal to the right-hand expression. This applies to numeric, boolean, and string values. | Returns true if the left-hand expression is equal to the right-hand expression. This applies to numeric, boolean, and string values. | ||
− | + | {{codesample|<pre> | |
− | {{codesample| | + | <if test="type = 'patent'"> |
− | <pre> | + | ... |
− | <if test="type = 'patent'"> | + | </if> |
− | ... | + | </pre>}} |
− | </if> | ||
− | </pre> | ||
− | }} | ||
===not equals=== | ===not equals=== | ||
− | |||
The inverse of the equals operator, this returns true if the expressions are not equal. | The inverse of the equals operator, this returns true if the expressions are not equal. | ||
− | + | {{codesample|<pre> | |
− | {{codesample| | + | <if test="type != 'book'"> |
− | <pre> | + | ... |
− | <if test="type != 'book'"> | + | </if> |
− | ... | + | </pre>}} |
− | </if> | ||
− | </pre> | ||
− | }} |
Latest revision as of 02:22, 21 February 2022
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
XML Configuration: EPScript - Control Format (EPC) - Citation - Workflow - Phrase - Template - XPAGE (static pages)
EPScript | ||
Contents
Operators
Logical Operators
and
Returns true if both the left-hand and the right-hand expressions return true.
<if test="type = 'book' and is_set( creators )"> ... </if>
or
Returns true if at least one of the expressions returns true.
<if test="type = 'book' or type = 'patent'"> ... </if>
not
Returns true if the expression is false and false if the expression is true.
<if test="!is_set( creators )"> ... </if>
Comparison Operators
lt
Returns true if the left-hand expression is less than the right-hand expression. This is only applicable to expressions that return numeric values.
<if test="length(editors) lt 6"> ... </if>
gt
Returns true if the left-hand expression is greater than the right-hand expression. This is only applicable to expressions that return numeric values.
<if test="length(editors) gt 1"> ... </if>
equals
Returns true if the left-hand expression is equal to the right-hand expression. This applies to numeric, boolean, and string values.
<if test="type = 'patent'"> ... </if>
not equals
The inverse of the equals operator, this returns true if the expressions are not equal.
<if test="type != 'book'"> ... </if>