INTERACT FORUM

Please login or register.

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

Author Topic: Expression - Count X in Y  (Read 2645 times)

ldoodle

  • Galactic Citizen
  • ****
  • Posts: 411
Expression - Count X in Y
« on: December 08, 2014, 10:08:11 am »

Where X is:

tracks or;
films or;
tv shows

and Y is:

album or;
series or;
any other field

So for an album that has 20 tracks, X would be 20, for a TV Series that has 3 seasons X would be 3, for a film franchise/collection that has 4 installments X would be 4.

Is it possible in newer versions?  I've seen a thread for MC13 that says "no".
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42373
  • Shoes gone again!
Re: Expression - Count X in Y
« Reply #1 on: December 08, 2014, 10:14:02 am »

You can use GroupCount(Field) to count the number of files or values in the current group.
Logged
Matt Ashland, JRiver Media Center

ldoodle

  • Galactic Citizen
  • ****
  • Posts: 411
Re: Expression - Count X in Y
« Reply #2 on: December 08, 2014, 10:29:36 am »

Thanks Matt, I'll give it a go.  What defines the "current group"?

Where is this documented, as I did look on the Expression wiki.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42373
  • Shoes gone again!
Re: Expression - Count X in Y
« Reply #3 on: December 08, 2014, 10:43:04 am »

The current group is undefined in the current build.  I don't know how that happened.

In a coming build, the current group is defined as the entire set of files in the list it's working on.
Logged
Matt Ashland, JRiver Media Center

ldoodle

  • Galactic Citizen
  • ****
  • Posts: 411
Re: Expression - Count X in Y
« Reply #4 on: December 09, 2014, 06:04:24 am »

In a coming build, the current group is defined as the entire set of files in the list it's working on.

Does that mean if I did GroupCount([Series]) that it would count the total number of files where [Series] is populated? If so that's no good for what I want to achieve.

Or does it mean it can/would count the number of files for a given category in a Theater View view?  If you look at my screenshot, that's what I hope to do.  So take a view of every film in the library, which shows the Series field, I then click on one which takes me to all installments for that Series.  I need to count the number of installments in the 'current' Series, not the number of Series' in the library, if that makes sense?

From what I've read, you need to 'create' the group before being able to reference the count?  Is that right?, so would I need to create the group in the 'Expression to group by' section, then use the count in the 'Expression to display' section?
Logged

ldoodle

  • Galactic Citizen
  • ****
  • Posts: 411
Re: Expression - Count X in Y
« Reply #5 on: December 09, 2014, 06:06:23 am »

Basically, I'm trying to overcome a 'problem' with auto-zoom: http://yabb.jriver.com/interact/index.php?topic=93808.0, in that when something is auto-zoomed it doesn't seem to display the level it's been auto-zoomed to (Name in my case) but rather the level it's been auto-zoomed from (Series in my case).

If that can be fixed, ignore this thread!
Logged

MrHaugen

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 3774
Re: Expression - Count X in Y
« Reply #6 on: December 09, 2014, 06:26:10 am »

I would also like better count tools. I've tried to for example count number of "Not watched" episodes in each TV Show. Number of tracks for each artist and so on. Count how many items there are in a category, and if it's as many as the last episode number. To check for missing episodes. This would push us a big step forward to summary info for categories like TV shows, Seasons, Artists and so on.
Logged
- I may not always believe what I'm saying

ldoodle

  • Galactic Citizen
  • ****
  • Posts: 411
Re: Expression - Count X in Y
« Reply #7 on: December 11, 2014, 03:44:18 am »

Does that mean if I did GroupCount([Series]) that it would count the total number of files where [Series] is populated? If so that's no good for what I want to achieve.

Or does it mean it can/would count the number of files for a given category in a Theater View view?  If you look at my screenshot, that's what I hope to do.  So take a view of every film in the library, which shows the Series field, I then click on one which takes me to all installments for that Series.  I need to count the number of installments in the 'current' Series, not the number of Series' in the library, if that makes sense?

From what I've read, you need to 'create' the group before being able to reference the count?  Is that right?, so would I need to create the group in the 'Expression to group by' section, then use the count in the 'Expression to display' section?

Any thoughts, anyone?

I had a thought last night about setting up a category that shows only films that have multiple installments (again, where Series count, for each franchise, is greater than 1), so this will come in handy.
Logged

ldoodle

  • Galactic Citizen
  • ****
  • Posts: 411
Re: Expression - Count X in Y
« Reply #8 on: December 14, 2014, 01:13:04 pm »

OK, getting somewhere:

Code: [Select]
if(isequal(groupcount(), 1, 2), [Name, 1], [Series, 1])
So if the count of items in a series is 1, it shows the name field, if not show the series field.  So when a 1 item series is auto-zoomed, because it's showing the Name field at the first level, it shows the Name field at the top when it's auto-zoomed.

This works well for films and live shows, because they're based on the Series and Name fields.

The problem is, I can't work out how to get it to work for TV shows.  Indeed, I don't think it can be done in a satisfactory manner, because they're based on the Series and Season fields.  If I changed it to:

Code: [Select]
if(isequal(groupcount(), 1, 2), TVInfo(SeasonDisplay), [Series, 1])
It would simply just show 'Season n', which is meaningless on a Series level view.  You'd have:

American Horror Story
Only Fools and Horses
Season 1 (for Homeland)
Season 1 (for Breaking Bad)

Using that expression also breaks Series and Season cover art.

So I think there are a couple of ways to 'fix' this:

1) Make auto-zoom selectable per root library item (or at all levels).  Add a checkbox inside the 'Set rules for display' option.  I could then turn it off for TV shows so it always shows the season level, even if there is only 1 season.  This actually makes a lot of sense anyway to me.
2) Change the way auto-zoom works so when something is auto-zoomed it always uses the Name field for Movies and Other sub types, or Season field for TV show sub type, rather than the level where it's been auto-zoomed from.

Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10935
Re: Expression - Count X in Y
« Reply #9 on: December 14, 2014, 03:47:40 pm »

I'm not sure I understand your problem for TV Shows.

Assume I have a setup like this (typical for TV Shows, which i actually have myself)
TV Shows -> Series -> Season -> Episodes

No matter how many Seasons there are for a Series, the "Series" level view will always show the Series name, and only once you enter it'll either show the Season list, or skip straight away to the episodes.
In fact thats how it generally works for everything, if you have a View grouped on "FieldX", it'll always show the value of "FieldX" in the listing, no matter if any sub-level would auto-zoom or not.

So while I understand what you are trying to accomplish with your Movie view (Showing "Name" in a "Series"-view), I'm not sure you actually need to do anything special for TV Shows?
Logged
~ nevcairiel
~ Author of LAV Filters

ldoodle

  • Galactic Citizen
  • ****
  • Posts: 411
Re: Expression - Count X in Y
« Reply #10 on: December 15, 2014, 02:10:40 pm »

The 'problem' I have is that in my opinion, auto zoom shows the wrong field, or the wrong level field, everywhere.

Each number represents a level:

......1...................2 (Series).............3 (Season)................4.........
TV Shows > American Horror Story > Season 1|2|3 > list of Episodes

So when getting to the 4th level, it would show 'Season 1|2|3' at the top in Theater View, with all episodes for Season 1|2|3.  This is correct.

Now lets say I only had 1 season (let's say Season 1) for American Horror Story:

......1..................2 (Series)....................3 (Season).....................4..........
TV Shows > American Horror Story > auto zoom (Season 1) > list of Episodes

Clicking on American Horror Story (2nd level) in this case auto zooms to a list of episodes (4th level) for Season 1, but it displays American Horror Story (2nd level) at the top.  This is incorrect.  If auto zoom didn't exist, I'd see a view (3rd level) that showed just Season 1, which when clicked would show Season 1 at the top.

...1........2 (Series).................3 (Name)............
Films > Happy Feet > Happy Feet|Happy Feet Two

Clicking on the 3rd level would show either Happy Feet or Happy Feet Two at the top.  Again this is correct.

...1........2 (Series).................3 (Name).............
Films > Happy Feet > auto zoom (Happy Feet Two)

But this shows Happy Feet (2nd level), not Happy Feet Two (3rd level) at the top.  Again this is incorrect.

That's what I think, anyway!
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10935
Re: Expression - Count X in Y
« Reply #11 on: December 15, 2014, 02:34:28 pm »

Your only complaint is what the location at the top of Theater View shows, not what it actually shows in the navigation?
Then that you won't be able to adjust without also messing up the navigation.
Logged
~ nevcairiel
~ Author of LAV Filters

ldoodle

  • Galactic Citizen
  • ****
  • Posts: 411
Re: Expression - Count X in Y
« Reply #12 on: December 16, 2014, 03:29:40 am »

Your only complaint is what the location at the top of Theater View shows, not what it actually shows in the navigation?

Yes.  If you see these posts, you'll see what I mean:

Theater View setup:
http://yabb.jriver.com/interact/index.php?topic=93808.msg647265#msg647265

The 3rd attachment in http://yabb.jriver.com/interact/index.php?topic=93808.msg647266#msg647266 shows Breaking Bad displayed at the top.  I think it should really show Season 1.
Logged

ldoodle

  • Galactic Citizen
  • ****
  • Posts: 411
Re: Expression - Count X in Y
« Reply #13 on: December 16, 2014, 04:19:55 am »

Then that you won't be able to adjust without also messing up the navigation.

As I say in the other thread I linked to, it may very well be a setup issue, rather than something that's not been designed the way I think it should  ;)
Logged

ldoodle

  • Galactic Citizen
  • ****
  • Posts: 411
Re: Expression - Count X in Y
« Reply #14 on: December 17, 2014, 03:56:08 am »

As I say in the other thread I linked to, it may very well be a setup issue, rather than something that's not been designed the way I think it should  ;)

Any thoughts Hendrik?
Logged
Pages: [1]   Go Up