INTERACT FORUM

Please login or register.

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

Author Topic: ItemCount  (Read 1799 times)

wer

  • Citizen of the Universe
  • *****
  • Posts: 2640
ItemCount
« on: September 27, 2019, 03:30:20 pm »

I'm looking at the new ItemCount function, and this is just to post some thoughts both for my benefit and others' as there is nothing in the Wiki yet about it.

The release notes say: "ItemCount(...) expression to allow giving the count of all the files in the database with the same album, artist, album key, etc."

ItemCount is very similar to GroupCount, and in some circumstances or views produces the same result.  But what I seem to be seeing is that generally:
-GroupCount counts "in this view or view item, the unique number of somethings
-ItemCount counts "the number of things in the something shown in this view"
    (where in both cases the something is referenced by the field in the parenthesis).

In other words, GroupCount(Album) returns the unique number of Albums in the view, where ItemCount(Album) returns the number of things (tracks) in the Album implied by the view you're in.

One cool thing I have seen is that ItemCount will take an expression, whereas GroupCount takes only a single field.
Example: ItemCount(/[Artist/] /[Soloists/]) will return the number of tracks that share the same Artist and Soloists as the track/album implied by the view.

I don't understand why we have to escape the square brackets for ItemCount, when we don't for GroupCount.  It seems clumsy and hard to read.  Maybe it's because ItemCount will accept an expression, but other things that take expression usually don't need the square brackets escaped.

Has anyone else noticed anything interesting about his new function?
Logged

Moe

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 718
  • Hi
Re: ItemCount
« Reply #1 on: September 27, 2019, 05:23:06 pm »

Code: [Select]
ItemCount(/[series/]/[season/])Will tell you how many episodes are in a season of a TV show.

Code: [Select]
ItemCount(/[series/]/[episode/])Will tell you how many episodes total you have of a specific show

I've been playing with this one in an attempt get a count of the amount of seasons that I have for a show.

Code: [Select]
itemcount(if/(isequal/(/[Episode/]/, 1/, 1/)/, /[Series/]/,/))
For every episode 1 you have of a series it will return that total.  So, if you have 5 seasons of a show, each starting with episode #1 it will return 5.  For every other episode it will return the grand total of all episodes in your library that aren't episode 1.

Code: [Select]
itemcount(/[series/]if/(isequal/(/[Episode/]/, 1/, 1/)/, /[Series/]/,/))

Pretty much the same as the last one, it has the same behavior for episode 1 but the other episodes will show you the total episodes you have for that specific series.  Not sure how useful either of these are, I was just experimenting.

Code: [Select]
ItemCount(/[artist/])
Tells you how many tracks you have from a specific artist.

Code: [Select]
ItemCount(albumkey/(/))
How many tracks are on a single album

Code: [Select]
ItemCount(albumkey/(/)/[disc #/])
How many tracks are on each disc of a set.


Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: ItemCount
« Reply #2 on: October 04, 2019, 07:48:15 am »

Is a way to see the number plays just as total for on artist, try it different expression but none give me the best result. I try to make a playlist base by artist-number plays and not yet at the end of my progress. Maybe someone?!
Logged

BigSpider

  • Galactic Citizen
  • ****
  • Posts: 352
Re: ItemCount
« Reply #3 on: October 04, 2019, 02:51:26 pm »

This expression itemcount(/[artist/] /[number plays/]) should give you the count you want SkGe, but I must confess that it doesn't seem to be working in a consistent fashion?
Logged
English spiders are kind of small, but when I was living in the African rain forest well ......

Moe

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 718
  • Hi
Re: ItemCount
« Reply #4 on: October 04, 2019, 03:02:55 pm »

This expression itemcount(/[artist/] /[number plays/]) will give you the count you want SkGe

That does not work. 

That will tell you how many songs you have by an artist that have the same play count.  So, if you have three songs that have all been played 20 times, it will return 3 for those three songs.  If you have 78 songs that have a playcount of 1 it will return 78 for those 78 songs.  etc. etc.
Logged

wer

  • Citizen of the Universe
  • *****
  • Posts: 2640
Re: ItemCount
« Reply #5 on: October 04, 2019, 03:32:46 pm »

Guys, what you are looking for is GroupSummary(Number Plays)

You can apply that in a panes or category view to an Artist category as thumbnail text or in an expression, and it will show you total plays for each artist.
Logged

BigSpider

  • Galactic Citizen
  • ****
  • Posts: 352
Re: ItemCount
« Reply #6 on: October 04, 2019, 03:33:03 pm »

I stand corrected, thanks for the explanation @Moe. :)
@wer I already do the group summary view - just hoping there was a nice little expression to stick in a column instead.
Logged
English spiders are kind of small, but when I was living in the African rain forest well ......

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: ItemCount
« Reply #7 on: October 04, 2019, 09:19:22 pm »

I know that groupsummary() do that, but if let say i want to build a playlist around number plays/artist with groupsummary() is not gone help me so i try to find a method to do that.
Logged
Pages: [1]   Go Up