INTERACT FORUM

Please login or register.

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

Author Topic: Help with a simple expression  (Read 2431 times)

amargolis

  • Junior Woodchuck
  • **
  • Posts: 61
Help with a simple expression
« on: January 29, 2014, 02:11:54 pm »

Looking to craft an expression that will assemble a semi-colon delineated list of all the composers on an album. I will use it to create a new field called "Album Composers" that I can use to browse my classical collection.

Why? Example album - Beethoven/Mendelssohn: Violin Concertos (Heifetz)

I already have each individual track tagged with its respective composer (both in the "composer" field and in the "name" field). But, if I had a field with the value "Beethoven, Ludwig Van; Mendelssohn, Felix" then I could locate the album via Beethoven but still see all the tracks on the album, instead of only the Beethoven. It would be great to preserve the album in its original sequence but still be able to browse by individual composer.

Thanks!
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Help with a simple expression
« Reply #1 on: January 29, 2014, 02:18:22 pm »

So you have albums with tracks by different composers, and want to aggregate those for an Album?
Logged
The opinions I express represent my own folly.

amargolis

  • Junior Woodchuck
  • **
  • Posts: 61
Re: Help with a simple expression
« Reply #2 on: January 29, 2014, 03:10:12 pm »

Yes, exactly. Thanks.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Help with a simple expression
« Reply #3 on: January 29, 2014, 04:33:07 pm »

So we'll have to setup a view that calculates this value (because the expression language only works track by track, but the some tricks in the view can do the aggregation).  Once you have the view, you can assign the values calculated to your field Album Composers.  For new albums, or when you make changes, you'll have to use this view once again to assign / update Album Composers.

Alternatively, you can make this field a Calculated field, but it will only be valid after you've visited this new view for the first time after you've launched MC on any given occasion (the values will die after quitting MC).

Are either of these OK?
Logged
The opinions I express represent my own folly.

amargolis

  • Junior Woodchuck
  • **
  • Posts: 61
Re: Help with a simple expression
« Reply #4 on: January 29, 2014, 04:45:41 pm »

Gotcha. The first option seems better. That way I just have to use the new view for one-time tagging of "Album Composers." Better to not have to worry about revisiting the new view all the time. Thanks for your help, as always!
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Help with a simple expression
« Reply #5 on: January 29, 2014, 05:51:32 pm »

Ok, create a new view, maybe a panes view.  Add Album and Composer as categories.

In the Set rules for file display, press the Import / Export button and add (via copy/paste) the following:

[=1save(,composers_[album])]=1 [=1save(listcombine(load(composers_[album]), [composer]), composers_[album])]=1

Now, in the view's file list, add an expression column:

load(composers_[album])

and name it something like Composers_album (calculated).  You should now see in this column your combined Composers list/Album.  You can now use that load() expression to assign to your own Album Composers field by selecting all the files, and in the Tag Action Window, editing Album Composers and pasting:

=load(composers_[album])

Now your field has values you can use.  Save this view for later updates, and maybe a reference to this post.
Logged
The opinions I express represent my own folly.

amargolis

  • Junior Woodchuck
  • **
  • Posts: 61
Re: Help with a simple expression
« Reply #6 on: January 29, 2014, 06:07:31 pm »

Very cool. Thanks!

Any way to add a rule to import settings so that this new view only imports albums with more than one composer? I've also added "Genre contains 'Classical'" for my purposes.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Help with a simple expression
« Reply #7 on: January 29, 2014, 06:10:00 pm »

You're welcome.

I'm confused by your terminology: "...this new view only imports albums with...".  Views don't import, they show what is already imported.  So are you asking if you can have auto-import exclude importing certain files, or if the view can not show certain files?
Logged
The opinions I express represent my own folly.

amargolis

  • Junior Woodchuck
  • **
  • Posts: 61
Re: Help with a simple expression
« Reply #8 on: January 29, 2014, 07:31:11 pm »

Oh, yeah I just meant I'd like the view to only display albums with more than one composer.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Help with a simple expression
« Reply #9 on: January 29, 2014, 08:10:00 pm »

Not for the view we just created.  This is a C​hicken and Egg problem.  The calculated values are not available until the file list has been generated, and by then, its too late to start filtering files.

Instead, just assign to your Album Composers field from the view, and in some other view then restrict Album Composers that aren't 2 or more items by adding this Set rules for file display rule:

   [=compare(listcount([Album Composers]), >, 1)]=1
Logged
The opinions I express represent my own folly.

amargolis

  • Junior Woodchuck
  • **
  • Posts: 61
Re: Help with a simple expression
« Reply #10 on: January 29, 2014, 08:19:21 pm »

Ok, cool. Thanks MrC.
Logged

amargolis

  • Junior Woodchuck
  • **
  • Posts: 61
Re: Help with a simple expression
« Reply #11 on: February 09, 2014, 05:23:59 pm »

After using this for a few days, I'm now thinking it would be better to have the "Album Composers" field be a calculated field. I can just set MC to open to the new view.

Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Help with a simple expression
« Reply #12 on: February 09, 2014, 05:43:12 pm »

Is that because the view is slow?

I think you have enough info to proceed.  Let me know otherwise.
Logged
The opinions I express represent my own folly.

amargolis

  • Junior Woodchuck
  • **
  • Posts: 61
Re: Help with a simple expression
« Reply #13 on: February 09, 2014, 06:12:59 pm »

I just underestimated how annoying it would be to update that "Composers (Album)" field every time I add new files. Would just be nice to have that generated automatically.

I can't find an option make the calculated field semi-colon dilimeted. The aggregated composer lists are just being treated as a single value.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Help with a simple expression
« Reply #14 on: February 09, 2014, 06:25:00 pm »

Calculated fields are just string fields.  You can use semicolons.  If you want the values split automatically, just add &datatype=[list] to the end of the expression in the view or column.
Logged
The opinions I express represent my own folly.

amargolis

  • Junior Woodchuck
  • **
  • Posts: 61
Re: Help with a simple expression
« Reply #15 on: February 09, 2014, 06:44:39 pm »

Great, seems to be working.

Thanks again!
Logged

amargolis

  • Junior Woodchuck
  • **
  • Posts: 61
Re: Help with a simple expression
« Reply #16 on: February 11, 2014, 03:46:40 pm »

Can you think of any way to set MC to automatically open straight to that new view each time it opens? I thought that option existed under "startup" but it appears that you can't set it to open to custom views.

Or, any other way to make the calculated values in the "Composers (Album)" appear without having to open the view that generates those values? The first way we tried this, manually assigning the values using "=load(composers_[album])" worked ok, but having them calculated is better.

This has already been a huge improvement and as always I'm really grateful for your help. I'm working on a step by step list to share this technique with other users. If we could figure out this last step I think we'd have a perfect solution.

Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Help with a simple expression
« Reply #17 on: February 11, 2014, 04:34:39 pm »

The only reliable way to get a view to open on start is to setup the Startup options to open to the Last Location, and leave a tab open.  Unfortunately, you still have to visit that tab to freshen the data.

You could also place the Set rules for file display on the Audio node in Standard View.  Then, these rules are available to all children by default, since they inherit these rules from the parent scheme.
Logged
The opinions I express represent my own folly.

amargolis

  • Junior Woodchuck
  • **
  • Posts: 61
Re: Help with a simple expression
« Reply #18 on: February 11, 2014, 07:07:39 pm »

Bam! So simple and so brilliant. Thank you.

Here's a detailed set of instructions that detail how to do this yourself (see post #195): http://www.computeraudiophile.com/f11-software/j-river-tips-and-techniques-user-experiences-repository-13684/index8.html#post297727

Have fun! (as if anyone besides me and MrC is reading this)
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Help with a simple expression
« Reply #19 on: February 11, 2014, 07:10:17 pm »

Nice!
Logged
The opinions I express represent my own folly.
Pages: [1]   Go Up