More > JRiver Media Center 27 for Windows
help wanted for aggregation functions
ghappe-MC:
Thanks DTC and WER,
Let me describe the problem in an other way. I need a view with just one field and so many records as there are different values of/in the field genre in the library. Lets call this field "Genre Counter". This field should contain, for example "Classical Music # 30271" telling me that there are 30271 records who contain, as one of the values in the genre field, the tag classical music. The next record could look like "Metal # 17840" and the next "House # 2354' etc, etc. Does this brief example clarifies my desire somewhat?
Greetings and many thanks,
Guido
ghappe-MC:
In SQL It would look, simplified, something like this:
SELECT (Genre), COUNT(Genre) FROM Library GROUP BY Genre ORDER BY (Genre) DESC;
Syntax depending on witch server you would use and in this example not showing the extraction from the individual values in the genre field
Guido
zybex:
You can define a View to show the total number of items in each category.
Create a Categories View, click Add... select "Expression". Fill in with:
Name: Genres
Expression to group by: [Genre]
Expression to Display: [Genre] (GroupCount())
Click OK and Save. It should now display the number of items next to each Genre on the tree. You can add other sub-groupings to the View using the same method.
To show the number also on the main panel, set the thumbnail text to "[Name] (GroupCount())"
zybex:
You can even apply color on the Display Expression:
[Genre, 1] <font color="#00E0E0"> (GroupCount())
wer:
--- Quote from: ghappe-MC on February 23, 2021, 10:17:44 am ---Thanks DTC and WER,
... "Classical Music # 30271" telling me that there are 30271 records who contain, as one of the values in the genre field, the tag classical music...
--- End quote ---
Meaning you just want the count of the files that have that tag, which is exactly what I said before.
So I would say Zybex's first answer was correct for what you actually first asked, because you said you wanted a count of albums. His latest answer is correct if you want files.
Moreover, as I said before, this is even more easily done in a panes view, if you want to do no work at all: click on the category you want, and at the bottom of the window in the status bar, MC shows you the count of files that have that tag. No expression work required. It's easy to overlook, but MC counts and summarizes everything you select that way.
Finally, if you want a simple list, instead of doing a Category view as Zybex described, do a panes view. And add a category as described before:
Name: Genres
Expression to group by: [Genre]
Expression to Display: [Genre] (GroupCount())
That will give you a nice list in one place without using the tree.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version