NEW: Added a SearchTags(...) expression function that takes a value and returns all the fields that have a match (the parameter after the value is an integer that when set to 1, just returns true or false for matches instead of the field names).
Just adding that one took way too long as I'm not familiar enough with wiki markup
Your link to the IsEqual command doesn't work though.I know,
I could well be wrong, but I think they might be helping with searches. So, if you search for ListMix() and press enter, it takes you directly there. Either way, I've made them just to keep as much uniformity as possible.
So the Function Index needs to be manually updated?
=== <span id="ListCombine">ListCombine(…)</span> ===
: Combines two delimited lists into a single delimited list.
{| style="width: 100%; border-spacing: 0; border: 0px solid black;" align="top" cellpadding="3" cellspacing="0"
|- id="ListCombine" valign="top"
! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 2px 1px 0 2px; border-right: 1px solid #bbb;" width="100" | Description
| style="background: #f9f9f9; color: #111; border-style: solid; border-width: 2px 2px 0 0" width="1200" | <span style="font-family: monospace,monospace; font-size:1em; color:#0f3f8d; font-size:110%"><b>listcombine(</b><i>list1</i><b>, </b><i>list2</i><b>, </b><i>input delimiter</i><b>, </b><i>output delimiter</i><b>, </b><i>mode</i><b>)</b></span>
The [[#ListCombine|ListCombine()]] function returns a single list after performing the operation specified by <i>mode</i> on the two lists <i>list1</i> and <i>list2</i>.
An <i>input delimiter</i> and an <i>output delimiter</i> may be specified.
The <i>input delimiter</i> is effective for both <i>list1</i> and <i>list2</i>, and the <i>output delimiter</i> will be used in the returned list, replacing the
<i>input delimiter</i> from both <i>list1</i> and <i>list2</i>.
Available <i>mode</i> values:
<div style="margin-left: 20pt;"><table style="border-spacing:0px; border-collapse:collapse; background: #f9f9f9">
<tr><td style="text-align:left; padding-right:20pt"><b>0</b></td><td>Combine lists removing duplicates (order is preserved).</td></tr>
<tr><td style="text-align:left; padding-right:20pt"><b>1</b></td><td>Output only items contained in both lists (order is preserved).</td></tr>
</table></div>
Argument <i>input delimiter</i> is optional (defaults to SEMICOLON).
Argument <i>output delimiter</i> is optional (defaults to SEMICOLON).
Argument <i>mode</i> is optional (defaults to 0).
|- valign="top"
! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 0px 1px 2px 2px; border-top: 1px solid #bbb; border-right: 1px solid #bbb;" | Examples
|style="background: #f9f9f9; color: #111; border-style: solid; border-width: 0px 2px 2px 0; border-top: 1px solid #bbb;" | <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>listcombine(a;b;e, a;b;c;d)</nowiki></b></span>
<p style="margin-left:20pt;">Returns <span style="font-family: monospace,monospace; font-size:1em;">a;b;e;c;d</span>.
This example uses the default <i>mode</i> 0 to combine <i>list1</i> with <i>list2</i>, preserving the order of items.
The default <span style="font-family: monospace,monospace; font-size:1em;">;</span> <i>input delimiter</i> and <i>output delimiter</i> is used.</p>
<span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>listcombine(a;b;e, a;b;c;d, ;, ;, 1)</nowiki></b></span>
<p style="margin-left:20pt;">Returns <span style="font-family: monospace,monospace; font-size:1em;">a;b</span>.
The <i>input delimiter</i> and <i>output delimiter</i> are both specified as <span style="font-family: monospace,monospace; font-size:1em;">;</span>,
and <i>mode</i> 1 is used to produce a list of only items that exist in both <i>list1</i> and <i>list2</i>.</p>
<span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>listcombine(a-c, c-f, -, ..., 0)</nowiki></b></span>
<p style="margin-left:20pt;">Returns <span style="font-family: monospace,monospace; font-size:1em;">a...c...f</span>. The <i>input delimiter</i> is <span style="font-family: monospace,monospace; font-size:1em;">-</span>, while the <i>output delimiter</i> is <span style="font-family: monospace,monospace; font-size:1em;">...</span>, and <i>mode</i> 0 combines both lists.</p>
<span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>listcombine(a#@#c, c#@#f, #@#, ., 0)</nowiki></b></span>
<p style="margin-left:20pt;">Returns <span style="font-family: monospace,monospace; font-size:1em;">a.c.f</span>. This example demonstrates how to combine two lists with duplicates removed while replacing a multi-character <i>input delimiter</i> <span style="font-family: monospace,monospace; font-size:1em;">#@#</span> with a single-character <i>output delimiter</i> <span style="font-family: monospace,monospace; font-size:1em;">.</span>.</p>
<span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>listcombine([people], [places])&datatype=[list]</nowiki></b></span>
<p style="margin-left:20pt;">The result here would be a single, semicolon delimited list containing all the list items from the [people] and [places] fields.
For example, if [people] contains <span style="font-family: monospace,monospace; font-size:1em;">Family\Mum; Family\Dad; Family\Gran</span>, and [places] contains <span style="font-family: monospace,monospace; font-size:1em;">UK\Scotland\Edinburgh; UK\Scotland\Edinburgh\Edinburgh Castle</span>,
the output list would be <span style="font-family: monospace,monospace; font-size:1em;">Family\Mum; Family\Dad; Family\Gran; UK\Scotland\Edinburgh; UK\Scotland\Edinburgh\Edinburgh Castle</span>.
Using the <span style="font-family: monospace,monospace; font-size:1em;">&datatype=[list]</span> cast makes the expression split individual list items in a panes or categories view.</p>
|}
<div style="text-align:right;">([[#top|Back to top)]]</div>
=== <span id="ListMix">ListMix(…)</span> ===
: Combine corresponding values from multiple lists into a new list, using a template to process each item.
{{function description box
| name=ListMix
| arguments=template, mode, list1, [list2, ... listN]
| description=
{{argument optional|mode|0}}
The [[#ListMix|ListMix()]] function processes the elements of one or more lists, returning a new list where each element is similar to the provided template modified with the elements of the list argument(s).
The number of list arguments to be mixed is variable, but at least one must be provided. The lists can have different lengths, with mode controlling the length of the returned list.
The first element of the returned list is generated by applying the first element of each provided list to the template; the second element is generated using the second element(s) of the list(s), and so on until all elements are processed, according to mode.
The <i>'''template'''</i> is a text string with placeholders like [L1], [L2], etc, indicating where the elements of the provided lists should be inserted. [L1] refers to elements of list1, [L2] refers to list2, and so on. The special placeholder [N] refers to the item number within the resulting list.
A <i>'''template'''</i> is also itself an Expression, so it can contain other functions/expressions. A template can be escaped using the escape sequence /#template#/. This is usually not required but may be useful to enter templates containing functions, commas, or other special symbols.
The default semi-colon list delimiter is used for both input and output lists.
{{argument table
| name=mode
| contents=
{{argument table row|0|Return as many elements as the '''longest''' provided list}}
{{argument table row|1|Return as many elements as the '''shortest''' provided list}}
{{argument table row|2|Return as many elements as the '''first''' provided list}}
}}
| examples=
'''{{monospace|<nowiki>ListMix(Actor #[N] is [L1],, a;b;c)</nowiki>}}'''
: Returns Actor #1 is a; Actor #2 is b; Actor #3 is c
This example uses mode 0 and demonstrates the usage of [N] and [L1] on a single list.
'''{{monospace|<nowiki>ListMix([L1][L2]=[L3], 0, a;b;c;d, 1;2;3;4;5, blue;red;green)</nowiki>}}'''
: Returns a1=blue; b2=red; c3=green; d4=; =5
Mode 0 returns 5 elements which is the length of the longest list. Note that on the last two the missing values on the template are also missing on the output.
'''{{monospace|<nowiki>ListMix([L1][L2]=[L3], 1, a;b;c;d, 1;2;3;4;5, blue;red;green)</nowiki>}}'''
: Returns a1=blue; b2=red; c3=green
: Mode 1 returns only 3 elements, the length of the shortest list.
'''{{monospace|<nowiki>ListMix([L1][L2]=[L3], 2, a;b;c;d, 1;2;3;4;5, blue;red;green)</nowiki>}}'''
: Returns : a1=blue; b2=red; c3=green; d4=
: Mode 2 returns only 4 elements, the length of the first list.
'''{{monospace|<nowiki>ListMix(FixCase([L1],3)=Math([L2]*[L3]),, aa;bb;cc, 10;20;30, 5;4;3)</nowiki>}}'''
: Returns : AA=50; BB=80; CC=90
: This example uses two different functions on the template to further transform each element of the lists before inserting it into the output.
'''{{monospace|<nowiki>ListMix(<img src=tooltip:actors\\[L1]> \ , 1, [Actors], 1;2;3;4;5)</nowiki>}}'''
: Returns (example): <img src=tooltip:actors\Daisy Ridley> ;<img src=tooltip:actors\Adam Driver> ;<img src=tooltip:actors\John Boyega> ;<img src=tooltip:actors\Oscar Isaac> ;<img src=tooltip:actors\Mark Hamill>
: This example transforms the [Actors] field into a list of <img> tags ready to load the actor thumbnails into the Theather View or Movie Tooltip. It uses mode 1 (shortest list) with a dummy [L2] list of 5 elements to make sure the resulting list is at most 5 items long. An alternative way to accomplish the same would be to use ListLimit([Actors],5) as [L1].
}}
This wiki editing discussion should be moved to its own thread...
The IsEqual link in the IfCase description has been fixed using [[Test and Comparison Functions#IsEqual|IsEqual()]] (as per reply #10)
My quest to learn more about this apparent shorthand led me to this page (https://wiki.jriver.com/index.php?title=Template:Function_description_preset&redirect=no) which helps, a lot :D
I changed it to that because I thought it was the correct way to do it, and the only way that worked. I changed it back because it sounded like it should work. Obviously not. I shall undo the change.I had already fixed it. There are plenty of these dotted throught the various expression function descriptions. I have stumbled across at least three by accident. No, I didn't fix them because I could'nt risk losing the current place in my mind for the expression I was adding at the time and knew I would get sidetracked onto a massively time consuming tangent!
My quest to learn more about this apparent shorthand led me to this page (https://wiki.jriver.com/index.php?title=Template:Function_description_preset&redirect=no) which helps, a lot :D
Marko, if I may, a little feedback/info on the Regex-2 documentation...Thanks Will, exactly what was needed. I'll get it mashed into the wiki page next weekend.
Multiple capture groups return invalid results, but that may be a bug.
Nested parenthesis create duplicate results, so one must avoid nested parenthesis.
Multiple capture groups seem to work fine. I suppose it depends what you define as "invalid".See my post here for an example. https://yabb.jriver.com/interact/index.php/topic,124543.msg870827.html#msg870827
Do note that we are using ECMAScript Regex syntax, and not PCRE, which you seem to be under the misconception of.Well, your current usage was only recently revealed. I was foolish enough to believe what had been written in the forum and wiki, sorry.
You seem to be representing the old Regex mode as entirely flawed and broken, but you should remove the "g" modifier from testing in other regex tools and you'll notice that it suddenly behaves quite in the same way.
One result per capture group. Not enough string to fill all captures? You get nothing.
See my post here for an example. https://yabb.jriver.com/interact/index.php/topic,124543.msg870827.html#msg870827
I don't think returning a list with a bunch of empty elements is a good idea. Someone might want to display it or use the resulting list for something else, and now you have an ugly hard to read list with a lot more elements than you had matches, and a lot more elements than can be used. I don't see the good in that.
I almost had Char() added but stumbled... I messed around with it a bit...
Char(189) returns ½
\u25CF/ returns a syntax error
u25CF returns nothing
ListMix(<img src=tooltip:actors\\[L1]> \ , 1, [Actors], 1;2;3;4;5)
Returns (example): <img src=tooltip:actors\Daisy Ridley> ;<img src=tooltip:actors\Adam Driver> ;<img src=tooltip:actors\John Boyega> ;<img src=tooltip:actors\Oscar Isaac> ;<img src=tooltip:actors\Mark Hamill>
ListMix(<img src=tooltip:actors\[L1]>, 1, [Actors], 1;2;3;4;5)
Returns (example): <img src=tooltip:actors\Daisy Ridley>;<img src=tooltip:actors\Adam Driver>;<img src=tooltip:actors\John Boyega>;<img src=tooltip:actors\Oscar Isaac>;<img src=tooltip:actors\Mark Hamill>
(You could use also "[L1]>/ " to add those spaces but maybe it just add unnecessary complexity here were we illustrate functionaliy of ListMix)Marko, if I may, a little feedback/info on the Regex-2 documentation...
First, it's important to note somewhere that MC's Regex() function takes a non-standard regular expression syntax, in that it will ONLY return results for things that are explicitly placed in a capture group.
<snip>
-Will
What is used now Hendrik?
The Wiki is out of date. It is probably important that people know what version of Regex is used.
https://wiki.jriver.com/index.php/String_Manipulation_Functions#Regex.28.E2.80.A6.29
https://wiki.jriver.com/index.php/Regular_expression_syntax
I'll update the Wiki, if I know what to say in it.
Range() (https://yabb.jriver.com/interact/index.php/topic,125477.msg869140.html#msg869140) was yours ;)
I reckon ListLimit() (https://wiki.jriver.com/index.php/List_Manipulation_Functions#ListLimit) could be tidied up and fleshed out a bit too.
I might find time to write something about my understanding of the Playlist Database in your other thread.Anything that might stimulate a corroborative response :)
I'll have a look at that if you like. I haven't done much so far really, but I ma checking bits and pieces as I work on other stuff. This is not an easy or quick task unless you are doing it often, which I'm not.For sure, go for it.
There's an undocumented function called itemcount() - seems to always return the number of files in the library. Not sure if takes arguments, I tried with different values and filter expressions.
I have a vague recollection of a discussion about a literal string output from an expression was required to some further processing. I have searched but can't find a reference.
- Literal(...) seems, well, pointless? The only thing I seem to be able to get it to do is convert a field like, say, duration, from an integer to a string value. Where would this function be useful?
Used for display only. can be used in the top Display area of Standard View, or in columns in Views. See image with example.
- RatingStars10(...) is broken, as in, also not doing anything.
It does indeed, almost, though, both of mine only use "Removed".
I had a ton of stuff with no [File Name] data in the "Other (4096)" database... Couldn't handle that so removed them all... It's like MC Feng-Shui :)
/# #/ Escapes everything inside this formatting.
That is the new comment functionality, not escaping everything, if I'm not mistaken.
/* ... /* is the Comment functionality.
Also, in the Resource.xml file, <!-- Comments in here --> is used for comments.
Thats a given, since its XML. Not our invention! :)
Is this all correct?
https://wiki.jriver.com/index.php/Grouping_Functions#GroupCountQuery
Well, I don't think the initial summary "Counts the number of items in a specified group" conveys the functionality correctly.Better now?
I also think it would be beneficial to add another simpler example, as all the escapes in your examples make it a bit hard to follow for the inexperienced.Still todo.
It's also helpful to contrast GroupCountQuery with GroupCount.I've added GroupSummaryQuery() today, and drawn attention to the difference in Example #1. As above, tweaking of GroupCountQuery() is still on the todo list. I feel my understanding is better today than it was last week, but could you give GroupSummaryQuery() (https://wiki.jriver.com/index.php/GroupSummaryQuery()) a quick once-over before I revisit GroupCountQuery()? Cheers.
A note about theater view is also helpful:I've added a paragraph to the "Preview" introduction at the top of the page referencing the usefulness of these two functions, specifically, in Theater View. This is about the time I discovered, that, as far as I could tell, there is nothing in the wiki covering the oh-so-powerful Theater View File Info Panel apart from a nod to its existence at the bottom of a TV Episodes page (https://wiki.jriver.com/index.php/TV_Episodes#Tweaks_to_Theater_View).
Because when you are looking at file details in Theater View you are always looking at a single file, GroupCountQuery and GroupSummaryQuery are the only ways to incorporate information about related files in your display.
We also need to add to the list:Done. (Added info to Expression Language Syntax intro on the main Expressions page.)
NEW: String literals can be defined in expressions by using /* comment here /*. The text will be output without any formatting. https://yabb.jriver.com/interact/index.php?topic=122149.0
ItemCount(...) https://yabb.jriver.com/interact/index.php?topic=122319.0Sorted.
Should add a link to Boolean Operations (https://wiki.jriver.com/index.php/Boolean_Operations) as they would be helpful, but not easy to find.I wasn't sure about this. The examples on that page were not immediately clear to me, and I didn't have time to spend on them, but, we do now have both And() and Or() functions... Are these the same as referenced on that page? If yes, that just leaves XOR, and I have no idea what that means, and a very quick Google only made things even less clear!! :D
We should reference functions that are available in the Player Display such as [Remaining Time], [Playlist Remaining Time] etc., which look like fields but aren't. See https://yabb.jriver.com/interact/index.php/topic,125595.0.html and search for more. Maybe these are already in the Wiki somewhere... Maybe not. This is all a quick search finds: https://wiki.jriver.com/index.php/PlayerWe should. I need a break though :)
I wasn't sure about this. The examples on that page were not immediately clear to me, and I didn't have time to spend on them, but, we do now have both And() and Or() functions... Are these the same as referenced on that page? If yes, that just leaves XOR, and I have no idea what that means, and a very quick Google only made things even less clear!! :D
Math(abs(3+5)) = 8
PadNumber(123, 4+1) = 0123 (not 00123)
min(10, 4+2) = 4 => +2 is ignored
math(3 + min(10, 4+2)) = 7 => not 9, because the min() is evaluated first as an independent function
max(5, 10+3) = 10 => +3 is ignored
math(1 + max(5, 10+3)) = 11 => not 14 as you would expect if it was a pure Math function
Rand(10, 20+1000) => returns numbers between 10 and 20, never above
Math(rand(10, 20+1000)) => same, rand is evaluated independently
RandN(10) => error, doesn't work outside of math
Math(RandN(10+1000)) => random between -1010 and 1010; the numbers are added up before calling RandN()