Accessing and Storing Functions: Difference between revisions
m (→SetField(…)) |
No edit summary |
||
Line 26: | Line 26: | ||
'''{{monospace|field(date, 0)}}''' |
'''{{monospace|field(date, 0)}}''' |
||
: Returns the raw, unformatted value stored in the {{monospace|date}} field. Note that this is equivalent to {{monospace|[date,0]}}. |
: Returns the raw, unformatted value stored in the {{monospace|date}} field. Note that this is equivalent to {{monospace|[date,0]}}. |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
}} |
}} |
||
Line 213: | Line 199: | ||
'''{{monospace|save(That, v)saveadd(v, This, 2)load(v)}}''' |
'''{{monospace|save(That, v)saveadd(v, This, 2)load(v)}}''' |
||
: Similar to the previous example, but using the prepend <i>mode</i>, resulting in the output {{monospace|This; That}}. |
: Similar to the previous example, but using the prepend <i>mode</i>, resulting in the output {{monospace|This; That}}. |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
}} |
}} |
||
Revision as of 05:22, 1 August 2021
- See also: Expression Language and Function Index
The functions in this section access field values, store and load global variables, access file tags, and access note fields.
Field(…)
- Returns a field's value.
Description | Field(name, mode)
The Field() function returns the value stored in field name. The format of return is selected by mode. Available mode values:
| ||||
---|---|---|---|---|---|
Examples | field(album)
field(date, 0)
|
FieldQuery(…)
- Return a list of matches based on a list of fields to search, from a selected scope of files.
Description | FieldQuery(fieldlist, valuelist, return, mode, scope)
The FieldQuery() function returns a list of matches based on a list of fields to search, from a selected scope of files..
Important Notes
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Examples | FieldQuery(Director,Ridley Scott,Name,1,1)
FieldQuery(Actors,Al Pacino,Name,0,0)
FieldQuery(Director;Actors, Sean Penn;Nicole Kidman, Name, 1, 0)
|
ItemCount(…)
- Counts the number of files that have the exact same value of the given expression as the file the expression runs in the context of.
Description | ItemCount(field)
The ItemCount() function counts the number of files that have the exact same value of the given expression as the file the expression runs in the context of. field is the library field name, or names, with control characters escaped, for which a count is desired. Notes:
The Interact forum has a useful thread that discusses the above notes in more detail. |
---|---|
Examples | ItemCount(/[Artist/])
ItemCount(/[Artist/]/[Genre/])
|
Load(…)
- Outputs the value of a global variable.
Description | Load(varname)
Loads and outputs the value of the specified global variable varname that has been previously stored with Save(). |
---|---|
Examples | load(var1)
save(math(1 + 2), sum)load(sum)
|
Note(…)
- Retrieve note fields.
Description | Note(field label, field type, occurrence)
The Note() function retrieves information from a Media Center Note. Specifically, it returns the contents associated with a field label, of a given field type. The Nth occurrence may be requested. Notes data may be simple text, or associated with defined a field label. Currently the only type of field label is contact information. The first line of a Note is associated with the omnipresent field label Name. The field type selects the specific sub-type for a given field label, and occurrence selects which instance of several field label / field type pairs is returned. The occurrence value is zero-based. |
---|---|
Examples | note(phone)
note(phone, home)
note(phone, home)
note(phone, home, 1))
|
Save(…)
- Saves a value to a global variable.
Description | Save(value, variable, mode)
This Save() function saves the value into the specified global variable, and optionally will return that value if mode is set. Once a global variable has been created using Save(), that variable's value is available for use with either Load() or the pseudo-field "[variable]". Available mode values:
| ||||
---|---|---|---|---|---|
Examples | save(Much Money, local_bank)
save(More Money, My Bank, 1)
save(math([duration,0] / 60), durmins)if(compare([durmins], >, 5.0), Long Track, Short Track)
Additional Examples |
SaveAdd(…)
- Adds to a global variable.
Description | SaveAdd(variable, value, mode)
The SaveAdd() function adds value to a global variable either numerically or as a list item. The mode argument indicates how variable is modified. Available mode values:
| ||||||
---|---|---|---|---|---|---|---|
Examples | saveadd(v, 1)
saveadd(v, math(2 - 6))
save(foo, v)saveadd(v, bar, 1)load(v)
save(That, v)saveadd(v, This, 2)load(v)
|
SetField(…)
- Sets a field's value.
Description | SetField(name, value)
The SetField() function sets the value of name to value. |
---|---|
Examples | setfield(album, Living in the Past)
|
Tag(…)
- Returns a file's physical tag.
Description | Tag(tag name)
The Tag() function reads and returns the value of tag name directly from a file. The Media Center Library database is not used with Tag(), and instead the specified file is read for the requested tag. The spelling and letter case of the tag name must match exactly those stored in the file. Performance note: This function must open and read the actual file, so its performance is significantly slower than other functions which operate on database fields. |
---|---|
Examples | tag(My Personal Tag)
tag(Gapless Header)
tag(exif: Date)
|