INTERACT FORUM

Please login or register.

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

Author Topic: MC 11 Expressions for List-type Fields  (Read 3338 times)

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42373
  • Shoes gone again!
MC 11 Expressions for List-type Fields
« on: April 20, 2005, 02:35:35 pm »

Media Center 11.0.245 adds list-type field handling for expressions.  This allows an expression to be a list of values.

For example, if an expressions resolves to "Abba; Bob Dylan; Metallica", these items will show up individually when browsing instead of as one long mess.

Here are a couple simple examples that show how you can use this to mix different data types into one column:

Artist: [Artist];Album: [Album];Genre: [Genre]

All [Media Type];[Media Type]: [File Type]

There's more documentation here: http://www.jrmediacenter.com/DevZone/DBExpressions.htm
Logged
Matt Ashland, JRiver Media Center

UnknownID

  • Guest
Re: MC 11 Expressions for List-type Fields
« Reply #1 on: April 20, 2005, 05:47:12 pm »

I gave the new list view of database expressions a try. I have never used these expressions before, but when I made a new view scheme I got results that were not intended. Maybe my method was too simple:

In “Audio Mode”
Went to the “Audio” node
Right-clicked at the top of the sorting columns in the main window and selected “Edit View Scheme”
I clicked on “Add” and “Advanced Expression”
For the name I used “Multiple Artists” and for the expression I used [Artist].
After clicking ok, the new column was populated but only by the artist fields that contained multiple artists. For example, “Martin O’Donnell” and  “Michael Salvatori” were there because the track “Halo” has “Martin O’Donnell; Michael Salvatori” for the artist, but Nobuo Uematsu” was not since the track “Prelude” has only him as the artist.

Also, If I click on any of the results in the new Multiple Artists column I get what looks like a random quantity and random mix of tracks.

Any thoughts?
UnknownID


Logged

rpalmer68

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2639
Re: MC 11 Expressions for List-type Fields
« Reply #2 on: April 20, 2005, 05:53:04 pm »

Matt,

I am getting some strange results with my view expression now:

I am using the following expression;

If(IsEmpty([Artists]), AlbumArtist(), [Artists])
Where "artists" is a list that is populated only for multiple artist tracks.

With the 11.0.244 I would get something like the following listed:

(multiple artists)
Abba
ACDC
Sting
Tommy;James Morrison
Vince Jones


With 11.0.245  the expression above only seems to be returning artist names from the "artists" field (the list), so I have loost Album Artists and the "(multiple artists)" (which I assume are returning as Stings).

When I select some artists in the pane it shows many albums where the artist is not in the Artist or Artists field .

It appears that the expression isn't able to handle a result that could be a list or a string.

I tried the following;
If(IsEmpty([Artists]), AlbumArtist()&DataType=[String], [Artists]),
but this doesn't work and goes back to returning "Tommy;James Morrison".


Can I email you a library backup somehow so you can see what I'm talking about?

Cheers
Richard
Logged

StiX

  • Regular Member
  • Recent member
  • *
  • Posts: 23
  • i really have nothing more to say...
Re: MC 11 Expressions for List-type Fields
« Reply #3 on: April 20, 2005, 06:01:05 pm »

Finally a reason to download a new beta. But wait, I've just read the updated DBExpressions.htm, there's no IsContain() function.

I hope it will be in next beta, so that I can test the new Formatting functions and the DBExpression output &DataType modifier.


Quote
After clicking ok, the new column was populated but only by the artist fields that contained multiple artists. For example, “Martin O’Donnell” and  “Michael Salvatori” were there because the track “Halo” has “Martin O’Donnell; Michael Salvatori” for the artist, but Nobuo Uematsu” was not since the track “Prelude” has only him as the artist.
By default the Output of Expression Columns is interpreted as List Data Type. That's very inconvenient, as the semicolon is a commonly used character and from all custom fields I have only  25% of list type. I hope Matt&Co will change this thoughtless behaviour (perhaps they decided to do this, because there was a feature request on parsing fields with semicolon-delimited lists). Currently you have to put &DataType=[String] to the end of almost each expression you will write. Also, read about other Data Types in Documentation http://www.jrmediacenter.com/DevZone/DBExpressions.htm

And, you should not use special characters in names of Artists. If the Track was done in cooperation of two performers, just use a comma or "feat." or "and".


Quote
It appears that the expression isn't able to handle a result that could be a list or a string.
I think there's a bug with AutoAlbum() function. Try the [Auto Album (auto)] calculated field-function, as it is an equivalent to the function.

The &DataType=[...] keyword is just a modifier of how the Output of the Expression is interpreted. This keyword should be added ONLY to the END of the expression. Read Docs.

I hope in future developers of MC will consult with users before making some decisions.
Logged

CDvd

  • Regular Member
  • World Citizen
  • ***
  • Posts: 208
Re: MC 11 Expressions for List-type Fields
« Reply #4 on: April 20, 2005, 07:54:13 pm »

Media Center 11.0.245 adds list-type field handling for expressions.  This allows an expression to be a list of values.

We can finally have [Artists],[Genres] and [Put your desired tag here +s] tags for free!
Really, really great Matt!  ;D
Logged
A computer without COBOL and Fortran is like a piece of chocolate cake without ketchup and mustard.

StiX

  • Regular Member
  • Recent member
  • *
  • Posts: 23
  • i really have nothing more to say...
Re: MC 11 Expressions for List-type Fields
« Reply #5 on: April 20, 2005, 08:06:45 pm »

About the updated documentation.
I think some of the explanations should be changed:

Quote
IsRange(...): Compares a value against a range and outputs a "1" if the values is inside the range, and "0" if not.
Determines whether a number or the first character of a string is a part of the specified range and outputs a "1" if the values is inside the range, and "0" if not.


Quote
Size(...): Returns the size of a file in a media-type independent manner.
Must be extended with detailed information of each media-type.
Returns Duration for files of Audio media-type


Quote
Clean(...): Returns a cleaned up version of a filled in template.
More details needed on what characters or character pairs is intended to clean and in what situations it will not do it.


Quote
FormatDate(...): Formats a date value in a specified manner.
Other Formatting should be explained in detail:
y/yy   Year/LZ   5/05
yyyy   Year   2005
M/MM   Month/LZ   1/01-12
MMMM   Month   ńł÷í˙, ęâłňí˙
d/dd   Day/LZ   1/01-31
m/mm   Minute/LZ   0/00-59
s/ss   Second/LZ   0/00-59


Quote
FormatRange(...): Formats a value as a range.
Range size: the number of letters / numbers to put in a grouping (optional: defaults to 1)
                   for letters: the number of letters to put in a grouping
                    for numbers: the size of a group of numbers


Quote
FormatBoolean(...): Formats a boolean (true / false) value in a specified manner.
Example
FormatBoolean(IsMissing(), File missing, File exists)
Correct will be: FormatBoolean(IsMissing([Filename]), File missing, File exists)





Quote
CustomData(...): Returns custom data stored in a file array. (used primarily for internal uses)
More details is needed on CustomData(). CustomData(#) returns 0 for each file.

I believe this function is not as hard to understand as the terms lpstr or wchar. It is totally unclear what do you mean on "file array". Array of what data of the file?
Logged

rpalmer68

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2639
Re: MC 11 Expressions for List-type Fields
« Reply #6 on: April 20, 2005, 10:29:20 pm »


I think there's a bug with AutoAlbum() function. Try the [Auto Album (auto)] calculated field-function, as it is an equivalent to the function.

The &DataType=[...] keyword is just a modifier of how the Output of the Expression is interpreted. This keyword should be added ONLY to the END of the expression. Read Docs.


I realise &DataType=[...] should only be used at the end of an expression, but hey not everything is documented so I thought I'd try!

Same result with [Auto Album (auto)], from what I can see my expression "If(IsEmpty([Artists]), AlbumArtist(), [Artists])"  returns a STRING for "AutoAlbum()" and a LIST for "Artists" and this is confusing things when both are trying to populate the same view scheme for some reason.


Richard
Logged

StiX

  • Regular Member
  • Recent member
  • *
  • Posts: 23
  • i really have nothing more to say...
Re: MC 11 Expressions for List-type Fields
« Reply #7 on: April 20, 2005, 10:46:33 pm »

Quote
but hey not everything is documented so I thought I'd try!
Everything is documented, except some specific behaviours of some functions.

Quote
Same result with [Auto Album (auto)]
Sorry, my mistake. Try
Code: [Select]
If(IsEmpty([Artists]), [Album Artist (auto)], [Artists])
Logged

rpalmer68

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2639
Re: MC 11 Expressions for List-type Fields
« Reply #8 on: April 20, 2005, 10:59:25 pm »


Sorry, my mistake. Try
Code: [Select]
If(IsEmpty([Artists]), [Album Artist (auto)], [Artists])

Both [Auto Album (auto)]   and [Album Artist (auto)] give the same result (which they shouldn't).  It's like the [Artists] result is the only one being recognised, while the Album Artist is ignored.

I think it's because the view scheme column can't handle a STRING and LIST result at the same time.


Richard
Logged

CDvd

  • Regular Member
  • World Citizen
  • ***
  • Posts: 208
Re: MC 11 Expressions for List-type Fields
« Reply #9 on: April 20, 2005, 11:54:30 pm »

Also, If I click on any of the results in the new Multiple Artists column I get what looks like a random quantity and random mix of tracks.

Same thing here !

I tryed to create an expression named "Artists" which was as simple as :
Code: [Select]
[Artist] &DataType=[List]
Selecting Eric Clapton in the view shows up 4 Eric's songs and 201 other songs that are totally unrelated (ACDC, Ben Harper,Daft Punk... )

I may have not understand the behaviour of  &DataType, but selecting Eric Clapton should have showed the 13 songs for which "Eric clapton" appears in the [Artist] tag, shouldn't it?
Logged
A computer without COBOL and Fortran is like a piece of chocolate cake without ketchup and mustard.

UnknownID

  • Guest
Re: MC 11 Expressions for List-type Fields
« Reply #10 on: April 21, 2005, 05:40:06 pm »

I gave the new list view of database expressions a try. I have never used these expressions before, but when I made a new view scheme I got results that were not intended. Maybe my method was too simple:

In “Audio Mode”
Went to the “Audio” node
Right-clicked at the top of the sorting columns in the main window and selected “Edit View Scheme”
I clicked on “Add” and “Advanced Expression”
For the name I used “Multiple Artists” and for the expression I used [Artist].
After clicking ok, the new column was populated but only by the artist fields that contained multiple artists. For example, “Martin O’Donnell” and  “Michael Salvatori” were there because the track “Halo” has “Martin O’Donnell; Michael Salvatori” for the artist, but Nobuo Uematsu” was not since the track “Prelude” has only him as the artist.

Also, If I click on any of the results in the new Multiple Artists column I get what looks like a random quantity and random mix of tracks.

All this was fixed for me in the latest build (11.0.246) and the expression: [Artist]&DataType=[List ] (obviously without the space, but the forum is interpreting it as the beginning of a list effect)

Thank you!
UnknownID




Logged

rpalmer68

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2639
Re: MC 11 Expressions for List-type Fields
« Reply #11 on: April 21, 2005, 06:21:46 pm »

All working properly for me now too.
Final expression is;

If(IsEmpty([Artists]), AlbumArtist(), [Artists])&DataType=[LIST ]

(one agaion without the space betwen the "T" & "]"


Thanks Matt & the team you're doing a great job getting MC11 ready for release.

Richard
Logged
Pages: [1]   Go Up