INTERACT FORUM

Please login or register.

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

Author Topic: GroupCount() for List fields  (Read 3820 times)

amandalishus

  • Recent member
  • *
  • Posts: 29
  • Experienced MC user masquerading as novice.
GroupCount() for List fields
« on: September 06, 2017, 11:29:10 am »

Hey, long-time user, first-time poster... but I've been delving deeper and deeper into the functionality of this amazing application, and I've finally found something that I can't figure out with the Wiki, the Forums and a little Google-fu.

So... what I'm looking for seems like it should be simple. I want a Categories view that lists all values contained in the [Actors] list, but I'd like the display to contain the GroupCount() for the specific value displayed.

Obviously this is trivial without the count; I can just set the Type to "Library field" and select Actors. Does exactly what I want.

Furthermore, it's a simple affair to add the count with a String field such as Series; I can set the Type to "Expression", use "[Series]" as the Group Expression and "[Series,1] (GroupCount())" as the Display Expression.

If I set the Type to "Expression", use "[Actors]" as the Group Expression and either leave the Display Expression empty or simply set it to "[Actors]", it shows identical functionality to the "Library field" usage above.

Unfortunately, as soon as I try to make the Display Expression anything more complicated -- even "[Actors,1]", let alone "[Actors,1] (GroupCount())" -- the Group Expression ceases functioning as an individual value from the List field and displays the entire field value (i.e. "Actor1;Actor2;Actor3")... along with the count of all movies containing that entire list of actors. Unsurprisingly, for any non-trivial data set this turns out to be 1.

Please, make me feel stupid... it seems like this ought to be easy, and I'm just being amazingly dense.

Bonus Points will be awarded if you can make it work with Swap()  :)
Logged
[color="#C133FF"][size=18]Documentary aficionado. [/size][size=16]Music lover. [/size][size=14]Software developer. [/size][size=12]Transgender geek. [/size][size=10]Interested in everything. [/size][size=8]Easily distracted...[/size][/color]

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: GroupCount() for List fields
« Reply #1 on: September 06, 2017, 03:20:58 pm »

You're making a Categories view and using an Expression as the type right?  Then using a Group By and Display expression.

I can't get the Display Expression to do ANYTHING on my system.  It doesn't matter what I put there; it always displays the same thing for the thumbnail text.  I tried putting various weird expressions in the Thumbnail Text area (under the menu for the view itself), but I couldn't get what you wanted.

I just read through the thread on using Groupings and it seems to indicate that this only works in the New Tagging Window and "for categories".  I'm not sure what that means because someone explicitly asked about Thumbnail text and was told "only for new tagging window and for categories".

https://yabb.jriver.com/interact/index.php?topic=81766.msg564453#msg564453

Sorry I couldn't be of any real help.  Good luck.

Brian.
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: GroupCount() for List fields
« Reply #2 on: September 07, 2017, 01:21:45 am »

I've never had much in the way of useful success with the GroupCount() function. But I'm not really sure what you are trying to achieve here either, so some more information would be good.

First, do you really mean you are using a Category View, or are you talking about adding Categories under a Panes View?

The example MrC gives here definitely looks like the column in a Panes View: https://yabb.jriver.com/interact/index.php/topic,81766.msg564675.html#msg564675 If you are really talking about a Categories View, I'm not sure where you expect the count to appear. Based on my research GroupCount doesn't work in Thumbnail text, although that has been requested at least once, and I didn't do a thorough search to see if anything was done about that.

I can see what you mean though. I built a simple panes View and restricted it to [Media Sub Type]="Movies", then added the Categories [Genre], [File type], [Name], and [Actors]. I put a GroupCount on [Genre] and [File Type], because those made counts sense. A Panes View puts a count on the header row for each Category/Column in the View anyway, so I got total counts for all categories, and counts for each group in [Genre], [File Type], and [Name] but no counts for the [Actors] rows, because each of those would be (1) anyway. As you can see, each Movie [Name] gets a count of (1). The Actors column nicely listed each actor in the movies selected via the higher (left) Categories. It does that whether I select one movie or all movies. See the first attached image.

Then I added GroupCount to the [Actors] Category and I see what you mean. The Actors field now gets treated as a String variable, and not a List. I even tried forcing it to be a List with the &datatype=[list] function, but that didn't work. Note the correct count at the end of the Actors list though. See the second attached image.

Is that what you were trying to build?
Is that the problem you were seeing?

If so, my question still is, what were you expecting to see, and how would it add value to what is in the View in in the first image?
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

amandalishus

  • Recent member
  • *
  • Posts: 29
  • Experienced MC user masquerading as novice.
Re: GroupCount() for List fields
« Reply #3 on: September 11, 2017, 10:23:30 am »

Yes, that's about what I was doing... your example is a bit more complicated than mine, since I only wanted a category with Actors, but the principle is the same. I was hoping to see the GroupCount value in the TreeViewNode (not sure what to call it, but that's the object name in the .NET Framework  ;)) rather than the tooltip though. In fact, I am seeing it in the place I hoped, but since it's treating the value as a String it always has a value of one (except for the most trivial example).

Bonus Points for trying to force the datatype to List, I hadn't considered that... sad that it didn't work though :(
Logged
[color="#C133FF"][size=18]Documentary aficionado. [/size][size=16]Music lover. [/size][size=14]Software developer. [/size][size=12]Transgender geek. [/size][size=10]Interested in everything. [/size][size=8]Easily distracted...[/size][/color]

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4226
Re: GroupCount() for List fields
« Reply #4 on: September 11, 2017, 06:01:40 pm »

I was curious so I tried this using Roderick's example.

It appears that using a list field as a filter in a pane view produces 1 row per unique value in the collection of underlying list field values & GroupCount shows the no of items in the library that contain that particular value (a single individual actor in this case) in its Actor field.

My point being I don't think this comment from the OP is correct

the Group Expression ceases functioning as an individual value from the List field and displays the entire field value (i.e. "Actor1;Actor2;Actor3")... along with the count of all movies containing that entire list of actors. Unsurprisingly, for any non-trivial data set this turns out to be 1.

The displayed value is the value in the field for a particular library item (i.e. the complete list of actors formatted with a ; delimiter). However the row itself, when acting as a filter, actually represents a single actor in that particular list. The count shown is then for the no of items in which that particular actor appears in the actors field for the matching library items.

You can see this more clearly, in my library anyway, using another list field, genre. There are fewer unique genres so more library items match any given genre hence it is easier to arrive at a count >1.

To illustrate, a contrived example in the attached pic. I limited the view to contain films that star both Tom Cruise and Simon Pegg, both of whom have appeared in just 2 MI films in my library. The actors list for those 2 films are not exactly the same though there is some overlap. The actors category now shows some 2s and some 1s appended to a long list of actors, i.e. the row now clearly represents an individual entry in that row not the entire pretty printed value.

jriver's behaviour here is to take a list that contains 1 or more lists of actors (i.e. the Actor field) and flatten that into a single list of the actors removing duplicates as it goes (aka it's really the set of actors that appear in the list of actor field values). This count is shown correctly in the "all" row. The problem is this is completely disconnected from the displayed value which is displaying a pretty print of the list of actors for some particular library entry.
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: GroupCount() for List fields
« Reply #5 on: September 11, 2017, 09:26:12 pm »

I had to read that about three times, then look through your example. Now I see it.

The number that GroupCount() has produced is a count of how many movies a specific Actor has appeared in, from the set shown in the View, as expected

So there are four results of (2) in your example, and they correspond to Actors "Tom Cruise", "Simon Pegg", "Ving Rhames", and "Michelle Monaghan".

But rather than just show the Actor being counted (the Category), MC displays the full contents of the [Actor] field for the record. One line per unique actor from all the movies in the filtered View.

So it is just the "Expression to Display" that is being mucked up. It should know, and be able to display, the Actor that is the current Category, just as it does without anything in the "Expression to Display" field. Also, the information that displays when you hover a mouse over the Thumbnail text is able to show the number of files that the Category appears in. So the value can be calculated for the Category and is being calculated for that text.

I'm leaning toward this being an unintended behaviour, colloquially known as a bug. Particularly as just putting [Actors] in the "Expression to Display" field also produces the unwanted display, even though that is supposed to have the same effect as leaving the "Expression to Display" field blank.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4226
Re: GroupCount() for List fields
« Reply #6 on: September 12, 2017, 02:23:37 am »

yes I did seem to write that in a particularly confusing way, sorry! edited a bit to tidy up but you've summed it up anyway

tl;dr it seems to be working as expected under the covers but the rendering of the values in the pane, when those values are sourced from a list field, is quite broken when a display expression is applied

I wonder if this has a fix that is in scope of the 1hr thread
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: GroupCount() for List fields
« Reply #7 on: September 12, 2017, 07:47:48 am »

I wonder if this has a fix that is in scope of the 1hr thread

The fix may be less than an hour, but describing the problem may take a few more than 10 lines!  ;D

I'm sure Jim has noticed this thread by now, and put it on a list somewhere.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

amandalishus

  • Recent member
  • *
  • Posts: 29
  • Experienced MC user masquerading as novice.
Re: GroupCount() for List fields
« Reply #8 on: September 16, 2017, 03:37:24 pm »

Hey, check it out! You guys are exactly right... the behavior is exactly what I wanted, except that the text in the TreeViewNode is the entire list rather than the individual entry. I honestly hadn't looked that far; I got hung up on the node text and didn't pay any attention to the actual results that display when the node is clicked.

Of course, this doesn't make the behavior any less frustrating, but it does prove just how shallowly I examined the problem. If I had come to that realization, I suspect I would have posted this as a potential bug rather than making the assumption that I was doing something wrong. It's just that I'm so very stupid, so very often, that I assumed this was merely another example of my own stupidity ;)

At any rate, I've learned a lot from this discussion. The only thing I haven't learned is if there is anything in particular that I need to do to report this as a bug. Any suggestions? I'm not sure to what the "less than one hour, more than ten lines " discussion above pertains. Is there some rule that bug reports must be ten lines? Or that bugs are only fixed if it takes less than one hour?

(Sorry for being all n00b on you, but I haven't been using the forum here long enough to really know the appropriate etiquette.)
Logged
[color="#C133FF"][size=18]Documentary aficionado. [/size][size=16]Music lover. [/size][size=14]Software developer. [/size][size=12]Transgender geek. [/size][size=10]Interested in everything. [/size][size=8]Easily distracted...[/size][/color]

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: GroupCount() for List fields
« Reply #9 on: September 16, 2017, 05:55:50 pm »

G'Day again Amandalishus.

The CEO of JRiver, JimH, reads everything posted on the forum. So he will already be aware of the problem. Of course that doesn't mean a fix will get a priority. There is a lot going on at the moment with a 64bit version of MC just released.

However, normally a user should post bug reports in the Build Thread for the version that the bug was found in. That gets read by the developers so is noticed. In fact, all the developers are active on the forum, so most stuff gets noticed, if not commented on. This issue is probably Matt's baby. You know, the man who wrote the APE audio format.  8)

The reference to "less than one hour, more than ten lines" is referring to a thread that Jim creates every now and then to collect a bunch of ideas to improve MC. There is one currently open, here: https://yabb.jriver.com/interact/index.php/topic,112049.0.html  Sometimes we users try to slip fixes into those threads, rather than just improvements. Cheeky us!  ;D
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

amandalishus

  • Recent member
  • *
  • Posts: 29
  • Experienced MC user masquerading as novice.
Re: GroupCount() for List fields
« Reply #10 on: September 21, 2017, 02:50:21 am »

OK then... I will assume that my bug has been dutifully reported. Then what? Is there any way to get a notification when it's fixed? Will they update this thread? (I assume not, having seen threads that just ended with, "Well, it's a bug," without any update, when I know that the bug has been fixed.)

I'm guessing that it's just a question of reading the release notes each time an upgrade is posted, which is fine... I'll just hope it happens to be easy enough (and/or interesting enough) that someone tackles it forthwith. I've been looking for a good excuse to pay for the MC23 upgrade, and this would certainly serve that purpose perfectly ;)

Again, thanks for everyone in your help in checking my santiy... as much as it's a shame I can't do exactly what I want, it's good to know that it's not just me :)
Logged
[color="#C133FF"][size=18]Documentary aficionado. [/size][size=16]Music lover. [/size][size=14]Software developer. [/size][size=12]Transgender geek. [/size][size=10]Interested in everything. [/size][size=8]Easily distracted...[/size][/color]

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: GroupCount() for List fields
« Reply #11 on: September 21, 2017, 06:44:29 am »

You understand the process pretty well; Identify the bugs, Confirm, Fix, move on. Not much notification other than the Release Notes. No list of what is being worked on. Still, stuff gets done.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42373
  • Shoes gone again!
Re: GroupCount() for List fields
« Reply #12 on: September 21, 2017, 08:50:15 am »

Next build will have this:
Changed: Improved the grouping logic in panes for the expression to display to better handle using something like [Actors].

Hopefully that helps :)
Logged
Matt Ashland, JRiver Media Center

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: GroupCount() for List fields
« Reply #13 on: September 21, 2017, 03:13:12 pm »

Sweet. That works as expected.  :D

You are such a good bloke Matt.  8)


Amandalishus, the change is in MC23.0.62 and above: https://wiki.jriver.com/index.php/Release_Notes_MC23
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

amandalishus

  • Recent member
  • *
  • Posts: 29
  • Experienced MC user masquerading as novice.
Re: GroupCount() for List fields
« Reply #14 on: October 25, 2017, 01:21:52 pm »

You guys are so cool... thank you! I love this software, you should hear me proselytizing to my friends. Now I can tell them that you fixed a bug for me as well :)
Logged
[color="#C133FF"][size=18]Documentary aficionado. [/size][size=16]Music lover. [/size][size=14]Software developer. [/size][size=12]Transgender geek. [/size][size=10]Interested in everything. [/size][size=8]Easily distracted...[/size][/color]
Pages: [1]   Go Up