INTERACT FORUM

Please login or register.

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

Author Topic: Anyone able to help writing an expression?  (Read 1207 times)

sirganty

  • Junior Woodchuck
  • **
  • Posts: 83
Anyone able to help writing an expression?
« on: April 29, 2013, 04:36:28 am »

Expressions rule
Period

But I'm trying to work out if something is possible.

I would like to write an expression for MCWS search that returns 4 random files from the 12 most recently imported albums excluding the 1 most recently imported album.

I can do the first bit easily enough, but I'm struggling to see if its possible to exclude the top result?

Any pointers?

Thanks
Logged

sirganty

  • Junior Woodchuck
  • **
  • Posts: 83
Re: Anyone able to help writing an expression?
« Reply #1 on: April 29, 2013, 04:41:48 am »

sorry, should have included where I'd got to:

so this returns 4 random (1 per album) files from the last 12 imported albums
[Media Type]=[Audio] [Album Type]=[Single artist (complete)] ~limit=-1,1,[Album] ~sort=[Date Imported]-d ~n=12 ~sort=Random ~n=4

just can't see if its possible to exclude the first result following the ~sort=[Date Imported]-d ~n=12

I thought about giving that set a ~seq and then filtering on [Sequence]>1 but there doesn't seem to be a way to add a filter later in the expression, or am I wrong?
I've tried just a filter ~[Sequence]=>1 and using a ~mix=11,100%,{[Sequence]=>1} but none yield any results.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Anyone able to help writing an expression?
« Reply #2 on: April 29, 2013, 11:02:35 am »

You'd want to select one track from each of the most recent albums, sorted by date imported descending, select 12 tracks, sort by Date Imported ascending, then select only 11 tracks, then expand albums to include all tracks, sort randomly, and then select 4 tracks:

~limit=-1,1,[Album],[Album Artist (auto)] ~sort=[Date Imported]-d ~n=12 ~sort=[Date Imported] ~n=11 ~a ~sort=Random ~n=4

btw. pedantically, this would be a search query (as opposed to an expression).
Logged
The opinions I express represent my own folly.

sirganty

  • Junior Woodchuck
  • **
  • Posts: 83
Re: Anyone able to help writing an expression?
« Reply #3 on: April 29, 2013, 11:09:23 am »

You sir, are a genius!

filter, limit, sort, limit, sort opposite, limit, sort random, limit again!
why didn't I think of that!

thanks MrC
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Anyone able to help writing an expression?
« Reply #4 on: April 29, 2013, 11:13:35 am »

Who don't love a good hepin' of flattery on a Monday morning?
Logged
The opinions I express represent my own folly.
Pages: [1]   Go Up