Test and Comparison Functions: Difference between revisions
(Added mode descriptions) |
No edit summary |
||
(10 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Function Type Page}} |
{{Function Type Page}} |
||
The functions in this section return a Boolean value of either 1 (true) or 0 (false). |
The majority of the functions in this section return a Boolean value of either 1 (true) or 0 (false). |
||
They are generally used to drive an action specified in one of the [[Conditional Functions|Conditional Functions]]. |
They are generally used to drive an action specified in one of the [[Conditional Functions|Conditional Functions]]. |
||
Line 28: | Line 28: | ||
'''{{monospace|if(compare(math(now() - [date modified, 0]), >, 21), Expired, formatdate([date modified, 0], elapsed))}}''' |
'''{{monospace|if(compare(math(now() - [date modified, 0]), >, 21), Expired, formatdate([date modified, 0], elapsed))}}''' |
||
: Outputs the age of files under 21 days old, or {{monospace|Expired}} for older files. |
: Outputs the age of files under 21 days old, or {{monospace|Expired}} for older files. |
||
}} |
|||
=== <span id="IsDigit">IsDigit(…)</span> === |
|||
: Determines whether or not a given value is digits. |
|||
{{function description box |
|||
| name=IsDigit |
|||
| arguments=value, characters |
|||
| description= |
|||
{{argument optional|Characters|<i>all</i>}} |
|||
The [[#IsDigit|IsDigit()]] function tests the given <i>value</i> to determine whether or not it is digits, returning "1" for a positive result, and "0" for a negative (not digits) result. |
|||
| examples= |
|||
'''{{monospace|<nowiki>isdigit(1234)</nowiki>}}''' |
|||
: Returns "1" as these are all digits. |
|||
'''{{monospace|<nowiki>isdigit(Check1-2)</nowiki>}}''' |
|||
: Returns "0" as these are not all digits. |
|||
}} |
|||
=== <span id="IsDriveMissing">IsDriveMissing(…)</span> === |
|||
: Tests for the prescence of a specified drive. |
|||
{{function description box |
|||
| name=IsDriveMissing |
|||
| arguments=Drive |
|||
| description= |
|||
The [[#IsDriveMissing|IsDriveMissing()]] function tests for the prescence of a specified drive, returning "1" for a positive (missing) result, and "0" for a negative (drive exists) result. Note that this function cannot work with drive names at all, <i>only</i> drive letters. |
|||
| examples= |
|||
'''{{monospace|<nowiki>isdrivemissing(C:\)</nowiki>}}''' |
|||
: Returns "0" as drive C: is available. |
|||
'''{{monospace|<nowiki>isdrivemissing(C:)</nowiki>}}''' |
|||
: Returns "0" as drive C: is available. Demonstrating the backslash is not essential for the function to operate correctly. |
|||
'''{{monospace|<nowiki>if(IsDriveMissing(V:),Please Connect Drive [volume name],Files are availble)</nowiki>}}''' |
|||
: Returns <nowiki>"Please Connect Drive V:"</nowiki> for all files residing on drive V: if it is missing, or, <nowiki>Files are availble</nowiki> if the drive is connected. |
|||
}} |
|||
=== <span id="IsEmpty">IsEmpty(…)</span> === |
|||
: Tests a value for emptiness. |
|||
{{function description box |
|||
| name=IsEmpty |
|||
| arguments=value, mode |
|||
| description= |
|||
{{argument optional}} |
|||
The [[#IsEmpty|IsEmpty()]] function tests the given <i>value</i> for emptiness. The <i>value</i> passed is typically an Media Center field, so that some action may be taken when the field is or is not empty. Returns 1 when the <i>value</i> is empty, otherwise 0. |
|||
{{argument table |
|||
| contents= |
|||
{{argument table row|0|String test (field must be empty to get a positive result).}} |
|||
{{argument table row|1|Numerical test (field must be empty, or contain 0 to get a positive result)}} |
|||
}} |
|||
Note that Media Center does not discriminate between a 0 <i>value</i> and an empty <i>value</i> for fields of type Integer and Decimal - both 0 and empty are considered equivalent for these field types. This is useful for fields such as the integer field Disc #, where an empty or 0 <i>value</i> implies that Disc # contains no useful data, and should be generally ignored or absent in display output. |
|||
Pay particular attention to the third example offered below, as it covers a caveat that comes with this particular function. |
|||
| examples= |
|||
'''{{monospace|<nowiki>isempty([comment], 0)</nowiki>}}''' |
|||
: If the comment field is empty, [[#IsEmpty|IsEmpty()]] returns 1, otherwise 0. |
|||
'''{{monospace|<nowiki>isempty([track #], 1)</nowiki>}}''' |
|||
: Performs a numerical test for data in the [track #] field. If the field is empty or 0, a 1 is returned, otherwise 0 is returned. |
|||
'''{{monospace|<nowiki>ifelse(!isempty([disc #]), [disc #])</nowiki>}}''' |
|||
: Outputs the <i>value</i> of the disc # field when it is not empty. |
|||
}} |
}} |
||
Line 71: | Line 137: | ||
'''{{monospace|<nowiki>if(isequal([filename (path)], classical, 8), Classical, Not Classical)</nowiki>}}''' |
'''{{monospace|<nowiki>if(isequal([filename (path)], classical, 8), Classical, Not Classical)</nowiki>}}''' |
||
: Because compare <i>mode</i> 8 has been specified, if the word {{monospace|classical}} appears anywhere in the case-insensitive file path, the expression will return {{monospace|Classical}}, and if not it will return {{monospace|Not Classical}}. |
: Because compare <i>mode</i> 8 has been specified, if the word {{monospace|classical}} appears anywhere in the case-insensitive file path, the expression will return {{monospace|Classical}}, and if not it will return {{monospace|Not Classical}}. |
||
}} |
|||
'''{{monospace|<nowiki>if(isequal([Genre], Pop;Rock, 9), Pop or some sort of Rock, Not Pop or Rock)</nowiki>}}''' |
|||
=== <span id="IsEmpty">IsEmpty(…)</span> === |
|||
: Because compare <i>mode</i> 9 has been specified, if '''<i>either</i>''' of the case sensitive sub-strings {{monospace|Rock}} or {{monospace|Pop}} appear anywhere in the Genre List Type field, the expression will return {{monospace|Pop or some sort of Rock}}, and if not it will return {{monospace|Not Pop or Rock}}. |
|||
: Tests a value for emptiness. |
|||
: Genres that match include "{{monospace|Pop}}" "{{monospace|Rock}}" "{{monospace|Pop;Rock}}" "{{monospace|Pop Rock}}" "{{monospace|Rock;Pop}}" "{{monospace|Popular;Rock}}" "{{monospace|Popular;Rock & Roll}}" "{{monospace|Rock & Roll}}" "{{monospace|Funk Rock}}" and "{{monospace|Alt. Rock}}", among others. |
|||
'''{{monospace|<nowiki>if(isequal([Genre], Pop;Rock, 11), Some sort of Pop Rock, Not Pop Rock)</nowiki>}}''' |
|||
{{function description box |
|||
: Because compare <i>mode</i> 11 has been specified, if the case sensitive sub-strings {{monospace|Pop}} and {{monospace|Rock}} '''<i>both</i>''' appear anywhere in the Genre List Type field, the expression will return {{monospace|Some sort of Pop Rock}}, and if not it will return {{monospace|Not Pop Rock}}. |
|||
| name=IsEmpty |
|||
: Genres that match include "{{monospace|Pop;Rock}}" "{{monospace|Pop Rock}}" "{{monospace|Rock;Pop}}" "{{monospace|Popular;Rock}}" and "{{monospace|Popular;Rock & Roll}}", among others. |
|||
| arguments=value, mode |
|||
: Genres that do not match include "{{monospace|Pop}}" "{{monospace|Rock}}" "{{monospace|Rock & Roll}}" "{{monospace|Funk Rock}}" and "{{monospace|Alt. Rock}}", among others. |
|||
| description= |
|||
{{argument optional}} |
|||
'''{{monospace|<nowiki>if(isequal([Genre], Pop;Rock, 13), Pop or some sort of Rock, Not Pop or Rock)</nowiki>}}''' |
|||
The [[#IsEmpty|IsEmpty()]] function tests the given <i>value</i> for emptiness. The <i>value</i> passed is typically an Media Center field, so that some action may be taken when the field is or is not empty. Returns 1 when the <i>value</i> is empty, otherwise 0. |
|||
: Because compare <i>mode</i> 13 has been specified, if '''<i>either</i>''' of the case sensitive full strings {{monospace|Rock}} or {{monospace|Pop}} appear in the Genre List Type field, the expression will return {{monospace|Pop or some sort of Rock}}, and if not it will return {{monospace|Not Pop or Rock}}. |
|||
: Genres that match include "{{monospace|Pop;Rock}}" "{{monospace|Pop;Rock & Roll}}" "{{monospace|Popular;Rock}}", among others. |
|||
: Genres that do not match include "{{monospace|Pop Rock}}" "{{monospace|Rock & Roll}}" "{{monospace|Rock, Popular}}" "{{monospace|Popular;Rock & Roll}}" "{{monospace|Funk Rock}}" and "{{monospace|Alt. Rock}}", among others. |
|||
'''{{monospace|<nowiki>if(isequal([Genre], Pop;Rock, 15), Some sort of Pop Rock, Not Pop Rock)</nowiki>}}''' |
|||
: Because compare <i>mode</i> 15 has been specified, if the case sensitive full strings {{monospace|Pop}} and {{monospace|Rock}} '''<i>both</i>''' appear in the Genre List Type field, the expression will return {{monospace|Some sort of Pop Rock}}, and if not it will return {{monospace|Not Pop Rock}}. |
|||
: Genres that match include "{{monospace|Pop;Rock}}" "{{monospace|Pop;Electronic;Rock}}" "{{monospace|Rock;Pop,Alt.Rock}}" "{{monospace|Rock;Pop}}" and "{{monospace|Rock;Punk;Pop}}", among others. |
|||
: Genres that do not match include "{{monospace|Pop}}" "{{monospace|Rock}}" "{{monospace|Popular;Rock}}" and "{{monospace|Pop;Rockabilly}}", among others. |
|||
{{argument table |
|||
| contents= |
|||
{{argument table row|0|String test (field must be empty to get a positive result).}} |
|||
{{argument table row|1|Numerical test (field must be empty, or contain 0 to get a positive result)}} |
|||
}} |
}} |
||
=== <span id="IsInPlayingNow">IsInPlayingNow(…)</span> === |
|||
Note that Media Center does not discriminate between a 0 <i>value</i> and an empty <i>value</i> for fields of type Integer and Decimal - both 0 and empty are considered equivalent for these field types. This is useful for fields such as the integer field Disc #, where an empty or 0 <i>value</i> implies that Disc # contains no useful data, and should be generally ignored or absent in display output. |
|||
: Tests to see if a file is in the Playing Now playlist. |
|||
{{function description box |
|||
Pay particular attention to the third example offered below, as it covers a caveat that comes with this particular function. |
|||
| name=IsInPlayingNow |
|||
| arguments=filepath |
|||
| description= |
|||
{{argument optional|filepath|[filename]}} |
|||
The [[#IsInPlayingNow|IsInPlayingNow()]] function tests if a file is in any zone's Playing Now list. Used as an expression category, pane or file list column allows distinguishing files that are in the Playing Now list. |
|||
| examples= |
| examples= |
||
'''{{monospace| |
'''{{monospace|IsInPlayingNow()}}''' |
||
: If the |
: If the file in the Playing Now list, returns 1, otherwise returns 0. |
||
'''{{monospace|<nowiki> |
'''{{monospace|<nowiki>if(isinplayingnow(), Queued, Not queued)</nowiki>}}''' |
||
: If the file in the Playing Now list, returns {{monospace|Queued}}, otherwise {{monospace|Not queued}}. |
|||
: Performs a numerical test for data in the [track #] field. If the field is empty or 0, a 1 is returned, otherwise 0 is returned. |
|||
'''{{monospace|<nowiki>ifelse(!isempty([disc #]), [disc #])</nowiki>}}''' |
|||
: Outputs the <i>value</i> of the disc # field when it is not empty. |
|||
}} |
}} |
||
=== <span id=" |
=== <span id="IsLowerCase">IsLowerCase(…)</span> === |
||
: Tests |
: Tests to see if a value is lower case. |
||
{{function description box |
{{function description box |
||
| name= |
| name=IsLowerCase |
||
| arguments=value, |
| arguments=value, characters |
||
| description= |
| description= |
||
{{argument optional|Characters|<i>all</i>}} |
|||
The [[#IsRange|IsRange()]] function tests if a <i>value</i> falls within a given <i>range</i> of values. If the <i>value</i> falls within the given <i>range</i>, 1 is returned, otherwise 0 is returned. |
|||
The [[#IsLowerCase|IsLowerCase()]] function tests the given <i>value</i> to determine whether or not it is lower case, returning "1" for a positive result, and "0" for a negative result. |
|||
| examples= |
|||
A <i>range</i> is specified in the form of low-high, where low and high are either letters or numbers. |
|||
'''{{monospace|<nowiki>IsLowerCase(tesT,1)</nowiki>}}''' |
|||
The lowest <i>value</i> comes first, the highest second. Both low and high must be the same kind (letters or numbers). |
|||
: Returns "1" as only one character is specified for the check, and the first character, is lower case. |
|||
The low and high values are inclusive. |
|||
'''{{monospace|<nowiki>IsLowerCase(tesT,3)</nowiki>}}''' |
|||
Some Example Ranges: |
|||
: Returns "1" as the first three characters are lower case. |
|||
'''{{monospace|<nowiki>IsLowerCase(tesT)</nowiki>}}''' |
|||
<div style="font-family: monospace,monospace; font-size:1em;"> |
|||
: Returns "0" as here, all characters will be tested, and one of them is <i>not</i> lower case. |
|||
<div style="margin-left: 20pt">1-100</div> |
|||
<div style="margin-left: 20pt">a-z</div> |
|||
<div style="margin-left: 20pt">c-d</div> |
|||
<div style="margin-left: 20pt">23-7542 </div> |
|||
</div> |
|||
| examples= |
|||
'''{{monospace|<nowiki>isrange([artist], a-c)</nowiki>}}''' |
|||
: Artist values of Abba or Blondie will result in a 1, but ZZ Top will return a 0. |
|||
'''{{monospace|<nowiki>if(isrange([bitrate], 96-191), Poor Quality, High Quality)</nowiki>}}''' |
|||
: Returns {{monospace|Poor Quality}} for any file whose bit rate falls in the <i>range</i> of 96 to 191, and returns {{monospace|High Quality}} for all other bit rates. |
|||
'''Additional Examples''' |
|||
:[http://wiki.jriver.com/index.php/CD_Reference_Number#Answer_2 Using IsRange() in a Search List.] |
|||
}} |
}} |
||
Line 141: | Line 206: | ||
The [[#IsMissing|IsMissing()]] function tests for the existence of a file in the file system. If the file is missing, the function returns 1, otherwise 0 is returned if the file exists. This function is useful for checking for missing files in a Library. [[#IsMissing|IsMissing()]] treats special entries such as ripped Blu-ray or DVDs as single files, even though they physically exist in the file system as several files and directories. |
The [[#IsMissing|IsMissing()]] function tests for the existence of a file in the file system. If the file is missing, the function returns 1, otherwise 0 is returned if the file exists. This function is useful for checking for missing files in a Library. [[#IsMissing|IsMissing()]] treats special entries such as ripped Blu-ray or DVDs as single files, even though they physically exist in the file system as several files and directories. |
||
''Note'': Any view or list that uses [[#IsMissing|IsMissing()]] will be slow, |
''Note'': Any view or list that uses [[#IsMissing|IsMissing()]] will be slow, as Media Center must interrogate each referenced file in the file system. The larger the number of files being queried, the longer it will take to produce results. Use [[#IsMissing|IsMissing()]] with care. |
||
| examples= |
| examples= |
||
'''{{monospace|<nowiki>ismissing()</nowiki>}}''' |
'''{{monospace|<nowiki>ismissing()</nowiki>}}''' |
||
Line 153: | Line 218: | ||
}} |
}} |
||
=== <span id=" |
=== <span id="IsOverridden">IsOverridden(…)</span> === |
||
: Tests |
: Tests if an expression is overridden by a value |
||
{{function description box |
{{function description box |
||
| name= |
| name=IsOverridden |
||
| arguments= |
| arguments=Field |
||
| description= |
| description= |
||
The [[#Expression_Language#Field_Values:_Override_the_expression.2C_and_.5BThis.5D|IsOverridden()]] funtion tests a given field for manual override with custom data. The option to override expression results with static data was added to MC28. This function, added in MC32 enables testing a given field for overriding data. |
|||
{{argument optional|filepath|[filename]}} |
|||
The [[#IsRemovable|IsRemovable()]] function tests if a file resides on removable media and if so, returns 1, and if not, returns 0. The Media Center field [Removable] also provides the same value for a given file. |
|||
| examples= |
|||
'''{{monospace|IsRemovable()}}''' |
|||
: Checks if the current file is on removable storage, and if so, returns 1, otherwise returns 0. |
|||
}} |
|||
The funtion returns 1 where the expression result is overridden and 0 (zero) where it is not. |
|||
=== <span id="IsInPlayingNow">IsInPlayingNow(…)</span> === |
|||
The ''Field'' argument is given <u>without</u> the familiar square brackets. |
|||
: Tests to see if a file is in the Playing Now playlist. |
|||
Once you begin overriding expression data, this function is vital as it enables you to remain on top of what is and what is not, overridden. |
|||
{{function description box |
|||
| name=IsInPlayingNow |
|||
| arguments=filepath |
|||
| description= |
|||
{{argument optional|filepath|[filename]}} |
|||
The [[#IsInPlayingNow|IsInPlayingNow()]] function tests if a file is in any zone's Playing Now list. Used as an expression category, pane or file list column allows distinguishing files that are in the Playing Now list. |
|||
| examples= |
| examples= |
||
'''{{monospace| |
'''{{monospace|<nowiki>IsOverridden(Population)</nowiki>}}''' |
||
: Returns 1 if the example expression based field ''Population'' has been overridden with custom data, and zero if it has not, and is using the actual expression result. |
|||
: If the file in the Playing Now list, returns 1, otherwise returns 0. |
|||
'''{{monospace|<nowiki>if(isinplayingnow(), Queued, Not queued)</nowiki>}}''' |
|||
'''{{monospace|<nowiki>If(IsOverridden(Population),Yes,No)</nowiki>}}''' |
|||
: If the file in the Playing Now list, returns {{monospace|Queued}}, otherwise {{monospace|Not queued}}. |
|||
: This could be useful when used in an expression column, in a file list, beside the actual Population column. It will return "Yes where the expression has been overridden, and No where it has not. |
|||
}} |
}} |
||
Line 199: | Line 256: | ||
: [http://yabb.jriver.com/interact/index.php?topic=57461.0 How to use IsPlaying() and IsInPlayingNow()] |
: [http://yabb.jriver.com/interact/index.php?topic=57461.0 How to use IsPlaying() and IsInPlayingNow()] |
||
: [http://yabb.jriver.com/interact/index.php?topic=58137.msg393905#msg393905 How to play an artist's full work when a genre is shuffling?] |
: [http://yabb.jriver.com/interact/index.php?topic=58137.msg393905#msg393905 How to play an artist's full work when a genre is shuffling?] |
||
}} |
|||
=== <span id="IsRange">IsRange(…)</span> === |
|||
: Tests a value for inclusion within a given range. |
|||
{{function description box |
|||
| name=IsRange |
|||
| arguments=value, range |
|||
| description= |
|||
The [[#IsRange|IsRange()]] function tests if a <i>value</i> falls within a given <i>range</i> of values. If the <i>value</i> falls within the given <i>range</i>, 1 is returned, otherwise 0 is returned. |
|||
A <i>range</i> is specified in the form of low-high, where low and high are either letters or numbers. |
|||
The lowest <i>value</i> comes first, the highest second. Both low and high must be the same kind (letters or numbers). |
|||
The low and high values are inclusive. |
|||
Some Example Ranges: |
|||
<div style="font-family: monospace,monospace; font-size:1em;"> |
|||
<div style="margin-left: 20pt">1-100</div> |
|||
<div style="margin-left: 20pt">a-z</div> |
|||
<div style="margin-left: 20pt">c-d</div> |
|||
<div style="margin-left: 20pt">23-7542 </div> |
|||
</div> |
|||
''See also:'' [[DateInRange()|DateInRange(…)]] |
|||
| examples= |
|||
'''{{monospace|<nowiki>isrange([artist], a-c)</nowiki>}}''' |
|||
: Artist values of Abba or Blondie will result in a 1, but ZZ Top will return a 0. |
|||
'''{{monospace|<nowiki>if(isrange([bitrate], 96-191), Poor Quality, High Quality)</nowiki>}}''' |
|||
: Returns {{monospace|Poor Quality}} for any file whose bit rate falls in the <i>range</i> of 96 to 191, and returns {{monospace|High Quality}} for all other bit rates. |
|||
'''Additional Examples''' |
|||
:[http://wiki.jriver.com/index.php/CD_Reference_Number#Answer_2 Using IsRange() in a Search List.] |
|||
}} |
|||
=== <span id="IsRemovable">IsRemovable(…)</span> === |
|||
: Tests to see if a file is stored on removable media. |
|||
{{function description box |
|||
| name=IsRemovable |
|||
| arguments=filepath |
|||
| description= |
|||
{{argument optional|filepath|[filename]}} |
|||
The [[#IsRemovable|IsRemovable()]] function tests if a file resides on removable media and if so, returns 1, and if not, returns 0. The Media Center field [Removable] also provides the same value for a given file. |
|||
| examples= |
|||
'''{{monospace|IsRemovable()}}''' |
|||
: Checks if the current file is on removable storage, and if so, returns 1, otherwise returns 0. |
|||
}} |
|||
=== <span id="IsUpperCase">IsUpperCase(…)</span> === |
|||
: Tests to see if a value is upper case. |
|||
{{function description box |
|||
| name=IsUpperCase |
|||
| arguments=value, characters |
|||
| description= |
|||
{{argument optional|Characters|<i>all</i>}} |
|||
The [[#IsUpperCase|IsUpperCase()]] function tests the given <i>value</i> to determine whether or not it is upper case, returning "1" for a positive result, and "0" for a negative result. |
|||
| examples= |
|||
'''{{monospace|<nowiki>IsUpperCase(TESt,1)</nowiki>}}''' |
|||
: Returns "1" as only one character is specified for the check, and the first character, is upper case. |
|||
'''{{monospace|<nowiki>IsUpperCase(TESt,3)</nowiki>}}''' |
|||
: Returns "1" as the first three characters are upper case. |
|||
'''{{monospace|<nowiki>IsUpperCase(TESt)</nowiki>}}''' |
|||
: Returns "0" as here, all characters will be tested, and one of them is <i>not</i> upper case. |
|||
}} |
}} |
||
Latest revision as of 14:17, 2 March 2024
- See also: {{#if:Expression Language |[[:Expression Language{{#if:||{{{l1}}}}}]] |Error: Template must be given at least one article name
}}{{#if:Expression Language#Function Index|{{#if:|, | and }} [[:Expression Language#Function Index{{#if:Function Index||Function Index}}]]
}}{{#if:|{{#if:|, |, and }} [[:{{{3}}}{{#if:||{{{l3}}}}}]]
}}{{#if:|{{#if:|, |, and }} [[:{{{4}}}{{#if:||{{{l4}}}}}]]
}}{{#if:|{{#if:|, |, and }} [[:{{{5}}}{{#if:||{{{l5}}}}}]]
}}{{#if:|{{#if:|, |, and }} [[:{{{6}}}{{#if:||{{{l6}}}}}]]
}}{{#if:|{{#if:|, |, and }} [[:{{{7}}}{{#if:||{{{l7}}}}}]]
}}{{#if:|{{#if:|, |, and }} [[:{{{8}}}{{#if:||{{{l8}}}}}]]
}}{{#if:|{{#if:|, |, and }} [[:{{{9}}}{{#if:||{{{l9}}}}}]]
}}{{#if:|{{#if:|, |, and }} [[:{{{10}}}{{#if:||{{{l10}}}}}]]
}}{{#if:|{{#if:|, |, and }} [[:{{{11}}}{{#if:||{{{l11}}}}}]]
}}{{#if:|{{#if:|, |, and }} [[:{{{12}}}{{#if:||{{{l12}}}}}]]
}}{{#if:|{{#if:|, |, and }} [[:{{{13}}}{{#if:||{{{l13}}}}}]]
}}{{#if:|{{#if:|, |, and }} [[:{{{14}}}{{#if:||{{{l14}}}}}]]
}}{{#if:|, and [[:{{{15}}}{{#if: || }}]]
}}{{#if:| —
Error: Too many links specified (maximum is 15)
}}
The majority of the functions in this section return a Boolean value of either 1 (true) or 0 (false). They are generally used to drive an action specified in one of the Conditional Functions.
Compare(…)[edit]
- Compares two numbers.
Description | Compare(value1, operator, value2)
The Compare() function compares two numeric values value1 and value2 using the specified operator. Available operator values:
Outputs 1 if the comparison is true, and 0 otherwise. | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Examples | compare([bitrate], <, 320)
if(compare(math(now() - [date modified, 0]), >, 21), Expired, formatdate([date modified, 0], elapsed))
|
IsDigit(…)[edit]
- Determines whether or not a given value is digits.
Description | IsDigit(value, characters)
The IsDigit() function tests the given value to determine whether or not it is digits, returning "1" for a positive result, and "0" for a negative (not digits) result. |
---|---|
Examples | isdigit(1234)
isdigit(Check1-2)
|
IsDriveMissing(…)[edit]
- Tests for the prescence of a specified drive.
Description | IsDriveMissing(Drive)
The IsDriveMissing() function tests for the prescence of a specified drive, returning "1" for a positive (missing) result, and "0" for a negative (drive exists) result. Note that this function cannot work with drive names at all, only drive letters. |
---|---|
Examples | isdrivemissing(C:\)
isdrivemissing(C:)
if(IsDriveMissing(V:),Please Connect Drive [volume name],Files are availble)
|
IsEmpty(…)[edit]
- Tests a value for emptiness.
Description | IsEmpty(value, mode)
The IsEmpty() function tests the given value for emptiness. The value passed is typically an Media Center field, so that some action may be taken when the field is or is not empty. Returns 1 when the value is empty, otherwise 0. Available mode values:
Note that Media Center does not discriminate between a 0 value and an empty value for fields of type Integer and Decimal - both 0 and empty are considered equivalent for these field types. This is useful for fields such as the integer field Disc #, where an empty or 0 value implies that Disc # contains no useful data, and should be generally ignored or absent in display output. Pay particular attention to the third example offered below, as it covers a caveat that comes with this particular function. | ||||
---|---|---|---|---|---|
Examples | isempty([comment], 0)
isempty([track #], 1)
ifelse(!isempty([disc #]), [disc #])
|
IsEqual(…)[edit]
- Compares two values in one of seventeen specified modes.
Description | IsEqual(value1, value2, mode)
The IsEqual() function compares value1 with value2 using any mode from the list of modes below. Outputs 1 when the comparison succeeds according to the mode, and 0 otherwise. Although the mode is specified as the last argument, the comparison should be mentally read as: value1 mode value2. Available mode values:
| ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Examples | isequal([artist], [album], 1)
if(isequal([artist], [album], 1), Eponymous, [album])
if(isequal([artist], [album], 1), Eponymous/,, [album]/))
if(isequal([filename (path)], classical, 8), Classical, Not Classical)
if(isequal([Genre], Pop;Rock, 9), Pop or some sort of Rock, Not Pop or Rock)
if(isequal([Genre], Pop;Rock, 11), Some sort of Pop Rock, Not Pop Rock)
if(isequal([Genre], Pop;Rock, 13), Pop or some sort of Rock, Not Pop or Rock)
if(isequal([Genre], Pop;Rock, 15), Some sort of Pop Rock, Not Pop Rock)
|
IsInPlayingNow(…)[edit]
- Tests to see if a file is in the Playing Now playlist.
Description | IsInPlayingNow(filepath)
The IsInPlayingNow() function tests if a file is in any zone's Playing Now list. Used as an expression category, pane or file list column allows distinguishing files that are in the Playing Now list. |
---|---|
Examples | IsInPlayingNow()
if(isinplayingnow(), Queued, Not queued)
|
IsLowerCase(…)[edit]
- Tests to see if a value is lower case.
Description | IsLowerCase(value, characters)
The IsLowerCase() function tests the given value to determine whether or not it is lower case, returning "1" for a positive result, and "0" for a negative result. |
---|---|
Examples | IsLowerCase(tesT,1)
IsLowerCase(tesT,3)
IsLowerCase(tesT)
|
IsMissing(…)[edit]
- Tests to see if a file exists on the system.
Description | IsMissing(filepath)
The IsMissing() function tests for the existence of a file in the file system. If the file is missing, the function returns 1, otherwise 0 is returned if the file exists. This function is useful for checking for missing files in a Library. IsMissing() treats special entries such as ripped Blu-ray or DVDs as single files, even though they physically exist in the file system as several files and directories. Note: Any view or list that uses IsMissing() will be slow, as Media Center must interrogate each referenced file in the file system. The larger the number of files being queried, the longer it will take to produce results. Use IsMissing() with care. |
---|---|
Examples | ismissing()
ismissing(C:\Music\My Lost File.mp3)
if(ismissing(), File is missing, File exists)
[=ismissing([filename])]=1
|
IsOverridden(…)[edit]
- Tests if an expression is overridden by a value
Description | IsOverridden(Field)
The IsOverridden() funtion tests a given field for manual override with custom data. The option to override expression results with static data was added to MC28. This function, added in MC32 enables testing a given field for overriding data. The funtion returns 1 where the expression result is overridden and 0 (zero) where it is not. The Field argument is given without the familiar square brackets. Once you begin overriding expression data, this function is vital as it enables you to remain on top of what is and what is not, overridden. |
---|---|
Examples | IsOverridden(Population)
If(IsOverridden(Population),Yes,No)
|
IsPlaying(…)[edit]
- Tests to see if a file is in currently being played.
Description | IsPlaying(filepath)
The IsPlaying() function tests if a file is playing in any zone. Used as an expression category, pane or file list column allows distinguishing files that are playing now. |
---|---|
Examples | ifelse(isplaying(), <font color="ff0000">♪<//font>, isinplayingnow(), ♪)
Additional Examples |
IsRange(…)[edit]
- Tests a value for inclusion within a given range.
Description | IsRange(value, range)
The IsRange() function tests if a value falls within a given range of values. If the value falls within the given range, 1 is returned, otherwise 0 is returned. A range is specified in the form of low-high, where low and high are either letters or numbers. The lowest value comes first, the highest second. Both low and high must be the same kind (letters or numbers). The low and high values are inclusive. Some Example Ranges: 1-100
a-z
c-d
23-7542
See also: DateInRange(…) |
---|---|
Examples | isrange([artist], a-c)
if(isrange([bitrate], 96-191), Poor Quality, High Quality)
Additional Examples |
IsRemovable(…)[edit]
- Tests to see if a file is stored on removable media.
Description | IsRemovable(filepath)
The IsRemovable() function tests if a file resides on removable media and if so, returns 1, and if not, returns 0. The Media Center field [Removable] also provides the same value for a given file. |
---|---|
Examples | IsRemovable()
|
IsUpperCase(…)[edit]
- Tests to see if a value is upper case.
Description | IsUpperCase(value, characters)
The IsUpperCase() function tests the given value to determine whether or not it is upper case, returning "1" for a positive result, and "0" for a negative result. |
---|---|
Examples | IsUpperCase(TESt,1)
IsUpperCase(TESt,3)
IsUpperCase(TESt)
|
SearchTags(…)[edit]
- Finds all fields that contain a value
Description | SearchTags(value, mode)
Available mode values:
The SearchTags() function tests for a value in any field and returns the list of fields it is in, or a binary for further processing. Note that this function tests the raw value in the field, and not the formatted value, so matches against numerical values such as date fields may give unexpected results. Also, this function searches every field for all files in the current View or Playlist, so it will not be fast in some uses. | ||||
---|---|---|---|---|---|
Examples | SearchTags(Beatles, 0)
SearchTags(Beatles, 1)
[=SearchTags(Beatles, 1)]=1
|