INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Expression Help - ListCombine()  (Read 6543 times)

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Expression Help - ListCombine()
« on: August 12, 2010, 10:07:01 am »

I would really need some more help with the ListCombine() expression.

I use ; as delimiter in the file tags and have an expression to join in a list type field all artists and composers:
Code: [Select]
ListCombine(ListCombine([artist],[Composer]),ListCombine([albumartist],[album artist]))&datatype=[list]The field albumartist is collected from the albumartist tag in my flac files and the other fields are the standard ones.

I just noticed that the expression did not work in the case where there was no albumartist or album artist (i.e. a VA album) AND there was only one item in artist and composer respectively. For such a file the expression would output only the composer value with an appended ";".

Just to investigate where the problem was I created a new list type field with just this expression:
Code: [Select]
ListCombine([artist],[Composer])&datatype=[list]
  • If artist is "Bonnie Tyler" and composer is "Jim Steinman" (for the song Total Eclipse of the Heart), the expression outputs just "Jim Steinman" (I would have expected "Bonnie Tyler;Jim Steinman").
  • If artist is "Bonnie Tyler" and composer is "Ronnie Scott; Steve Wolfe" (for the song It's a Heartache), the expression outputs "Steve Wolfe;Ronnie Scott;Bonnie Tyler" as I had expected.
  • If artist is "Bonnie Tyler" and composer is empty, the expression outputs "Bonnie Tyler;" (with an appended ";", but the field still works in panes).
  • If artist is "Bonnie "Prince" Billy; Will Oldham" and composer is "Will Oldham", the expression outputs just "Will Oldham; Will Oldham" (I would have expected "Bonnie "Prince" Billy; Will Oldham").

Am I missing something obvious? Is the behaviour I am seeing the intended?

(Sorry for cross posting, but by mistake I posted this in an old thread in the MC 14 forum where I had received some good help and I could not figure out how to delete that post.)
Logged

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4580
Re: Expression Help - ListCombine()
« Reply #1 on: August 12, 2010, 10:44:20 am »

indeed. i see the same. its as if the first item is left out from the first field in the listcombine function. the ; at the end should also not be there.

 :)
gab
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42373
  • Shoes gone again!
Re: Expression Help - ListCombine()
« Reply #2 on: August 12, 2010, 11:26:43 am »

This should be fixed in 15.0.95 and later:
Fixed: The ListCombine(...) expression function did not work properly with single item lists. (only applies to last few builds)

Sorry for the trouble.
Logged
Matt Ashland, JRiver Media Center

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: Expression Help - ListCombine()
« Reply #3 on: August 12, 2010, 11:40:43 am »

This should be fixed in 15.0.95 and later:
Fixed: The ListCombine(...) expression function did not work properly with single item lists. (only applies to last few builds)

Sorry for the trouble.

Thanks for the replies!

OK, that explains why I had not noticed this before and why I could not solve this mystery by myself...
Logged

Vincent Kars

  • Citizen of the Universe
  • *****
  • Posts: 1154
Re: Expression Help - ListCombine()
« Reply #4 on: August 12, 2010, 12:52:41 pm »

What happens if you use ListBuild?
Logged

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4580
Re: Expression Help - ListCombine()
« Reply #5 on: August 12, 2010, 01:49:12 pm »

What happens if you use ListBuild?
crazy.. i guess i missed that one, wonder when that was introduced.  8).. thanks.

I use ; as delimiter in the file tags and have an expression to join in a list type field all artists and composers:
Code: [Select]
ListCombine(ListCombine([artist],[Composer]),ListCombine([albumartist],[album artist]))&datatype=[list]The field albumartist is collected from the albumartist tag in my flac files and the other fields are the standard ones.


guess this would work indeed:
Code: [Select]
ListBuild(1,;,[artist],[Composer],[albumartist],[album artist])&datatype=[list]
have just had a quick play with it. not sure i did it right in your code, and if the datatyp=list is still neccesarry.

later more time to play.

 :)
gab
Logged

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: Expression Help - ListCombine()
« Reply #6 on: August 13, 2010, 03:00:44 am »

Thanks for the new replies!

The ListBuild() function seems to work. I had not seen anything about it on the expression language page in the wiki. The code looks cleaner than with nested ListCombine() functions. With the ListBuild() function the list delimiter can (must?) be set directly in the function without using an additional replace() function and with the ListCombine() function you can separate the combined fields with a delimiter. Do you know if there is any other difference between the two functions, apart from the fact that the ListCombine() function is broken in the currently available build?
Logged

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: Expression Help - ListCombine()
« Reply #7 on: August 14, 2010, 12:35:47 pm »

This should be fixed in 15.0.95 and later:
Fixed: The ListCombine(...) expression function did not work properly with single item lists. (only applies to last few builds)

At least this observation is still valid with the .95 build:
Code: [Select]
ListCombine([artist],[Composer])&datatype=[list]
  • If artist is "Bonnie Tyler" and composer is empty, the expression outputs "Bonnie Tyler;" (with an appended ";", but the field still works in panes).

And could you please have a look at the ListBuild() function as well. It seems to have changed with the latest build. If both Artist and Composer is "Bob Dylan",
Code: [Select]
ListCombine([artist],[composer])&datatype=[list]outputs just "Bob Dylan", as expected, while
Code: [Select]
ListBuild(1,;,[artist],[composer])&datatype=[list]outputs "Bob Dylan;Bob Dylan".

The appended ";" and the duplicated item do not matter in panes, but it leads to problems when trying to use the duplicates functions in smartlists.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42373
  • Shoes gone again!
Re: Expression Help - ListCombine()
« Reply #8 on: August 14, 2010, 12:42:55 pm »

By design, ListBuild(...) does not remove duplicates.  ListCombine(...) does remove duplicates.
Logged
Matt Ashland, JRiver Media Center

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: Expression Help - ListCombine()
« Reply #9 on: August 15, 2010, 03:08:49 am »

Thanks for the prompt reply!

By design, ListBuild(...) does not remove duplicates.  ListCombine(...) does remove duplicates.

Aha, I was in the progress of switching all ListCombine() functions to ListBuild() functions (if I could find all of them...) when the new build was released and I had not fully tested what the ListBuild() function actually did. And just writing
Code: [Select]
[artist];[Composer]&datatype=[list]would produce the result I just reported for the ListCombine() function (with a redundant ";" when artist or composer, or both, is empty) and duplicates as well. If the redundant ";" is fixed for the ListCombine() function I guess I could combine the two functions to get rid of duplicates:
Code: [Select]
ListCombine(ListBuild(1,;,[artist],[composer],[album artist],[albumartist]),)&datatype=[list]or simply
Code: [Select]
ListCombine([artist];[composer];[album artist];[albumartist],)&datatype=[list]
A little bit more documentation of the functions would be welcome, with more example expressions and examples of in which cases a function can be useful. I, for instance, cannot figure out when a (third) function to make one list of values from several fields that puts duplicates in the resulting list could be useful. But as I have revealed a couple of times before my imagination (and the J River documentation) is more limited than the many features of MC.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Expression Help - ListCombine()
« Reply #10 on: August 15, 2010, 04:10:49 am »

Quote
A little bit more documentation of the functions would be welcome, with more example expressions and examples of in which cases a function can be useful. I, for instance, cannot figure out when a (third) function to make one list of values from several fields that puts duplicates in the resulting list could be useful. But as I have revealed a couple of times before my imagination (and the J River documentation) is more limited than the many features of MC.

I'm working on this at the moment... It might take a week or two, but I am working on it!

-marko

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: Expression Help - ListCombine()
« Reply #11 on: August 15, 2010, 04:17:38 am »

I'm working on this at the moment... It might take a week or two, but I am working on it!

-marko

That is great to hear! Please make an announcement in the forums when you publish the result of your efforts.
Logged

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: Expression Help - ListCombine()
« Reply #12 on: August 15, 2010, 04:23:03 am »

PS. I see from your signature that you seem to be running a .96 build. Are intermediate builds publicly available somewhere or are they only for the "MC15 Beta Team" as is stated under your name?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Expression Help - ListCombine()
« Reply #13 on: August 15, 2010, 11:28:49 am »

Ask JimH.
Logged
The opinions I express represent my own folly.

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4580
Re: Expression Help - ListCombine()
« Reply #14 on: August 15, 2010, 11:31:02 am »


Code: [Select]
ListCombine(ListBuild(1,;,[artist],[composer],[album artist],[albumartist]),)&datatype=[list]or simply
Code: [Select]
ListCombine([artist];[composer];[album artist];[albumartist],)&datatype=[list]
  8) i like those....nice

 :)
gab
Logged

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: Expression Help - ListCombine()
« Reply #15 on: August 29, 2010, 06:33:02 am »

In the .101 build this issue is still there:

Code: [Select]
ListCombine([artist],[Composer])&datatype=[list]
  • If artist is "Bonnie Tyler" and composer is empty, the expression outputs "Bonnie Tyler;" (with an appended ";", but the field still works in panes).

These expressions seem to always append a ";":
Code: [Select]
ListCombine(ListBuild(1,;,[artist],[composer],[album artist]),)&datatype=[list]
ListCombine([artist];[composer];[album artist],)&datatype=[list]

All three expressions above result in duplicate entries in some cases. The expressions return
Code: [Select]
U2;Bono; Adam Clayton; The Edge; Larry Mullen Jr.; U2 [the latter two expressions also append a ;]
for a file tagged like this (I have not found a way to copy and paste the database fields for a file):


MPEG-1 Layer 3
241 Kbit VBR
44.1 Khz Joint stereo

Copyrighted: No
Original: Yes
Protected by CRC: No
Encoder: LAME
Gapless: Yes (576 start, 1860 end)

ID3v1 Tag: none

ID3v2.3 Tag: (40821 bytes)
  TIT2 (Name): I Still Haven't Found What I'm Looking For
  TPE1 (Artist): U2
  TPE2 (Album Artist): U2
  TALB (Album): The Joshua Tree
  TRCK (Track #): 2
  TYER (Year): 1987
  TCON (Genre): Pop/Rock
  TCOM (Composer): Bono; Adam Clayton; The Edge; Larry Mullen Jr.; U2
  USLT (Lyrics): <too large to display>
  TPUB (Publisher): Island Records
  APIC (MP3T107517669) (Cover): <too large to display>
  TXXX (Album Artist): U2
  TXXX (Album rating): 5
  TXXX (Mood): <too large to display>
  TXXX (MusicMagic Data): <too large to display>
  TXXX (MusicMagic Fingerp..): <too large to display>
  TXXX (replaygain_album_g..): -4.81 dB
  TXXX (replaygain_album_p..): 1.029673
  TXXX (replaygain_track_g..): -4.75 dB
  TXXX (replaygain_track_p..): 1.010810
  TXXX (Review): <too large to display>
  TXXX (Style): College Rock; Album Rock; Alternative/Indie Rock; Contemporary Pop/Rock; Alternative Pop/Rock; Post-Punk
  TXXX (Theme): Motivation; Empowering; School; Feeling Blue; Affirmation; Introspection; Reflection
  TXXX (Tool Name): Media Center
  TXXX (Tool Version): 15.0.101
-----------------------------------------

Could you please have another look at the ListCombine() function.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42373
  • Shoes gone again!
Re: Expression Help - ListCombine()
« Reply #16 on: August 30, 2010, 12:40:17 pm »

Coming in build 102 (or newer):

Changed: Using the expression function ListCombine(...) with an empty string no longer outputs an empty list item.
Changed: Added optional 'Output delimiter' parameter for ListCombine(...) function so the input and output can use different delimiters.
Changed: ListItem(...) and ListCombine(...) expression functions eat white space surround delimiters when building / analyzing lists.
Logged
Matt Ashland, JRiver Media Center

Vincent Kars

  • Citizen of the Universe
  • *****
  • Posts: 1154
Re: Expression Help - ListCombine()
« Reply #17 on: August 30, 2010, 12:55:29 pm »

One who does it all?
ListCreate(NO|EMPTY,NO|DUP ,(multuple split char),Output delimiter,[Field1],[Field2],......)
Logged

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: Expression Help - ListCombine()
« Reply #18 on: August 31, 2010, 02:53:33 am »

Coming in build 102 (or newer):

Changed: Using the expression function ListCombine(...) with an empty string no longer outputs an empty list item.
Changed: Added optional 'Output delimiter' parameter for ListCombine(...) function so the input and output can use different delimiters.
Changed: ListItem(...) and ListCombine(...) expression functions eat white space surround delimiters when building / analyzing lists.


Thanks!

I guess that should do it.
Logged

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: Expression Help - ListCombine()
« Reply #19 on: September 05, 2010, 04:57:48 am »

Changed: Using the expression function ListCombine(...) with an empty string no longer outputs an empty list item.

Thanks for the new build!

I thought the above meant that there would be no empty list items at all in the combined list. Any chance of having that functionality? This expression still produces an empty list item if [Composer] is empty:
Code: [Select]
ListCombine([artist];[composer];[album artist],)&datatype=[list]
The space eating mechanism seems to work and I cannot find any duplicates in the combined list.

Perhaps you could provide an example in the help tooltip showing the syntax for the new input/output delimiter parameters.
Logged
Pages: [1]   Go Up