INTERACT FORUM

Please login or register.

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

Author Topic: Lend me a hand with this currently incorrect expression?!  (Read 4836 times)

Saucepan

  • Junior Woodchuck
  • **
  • Posts: 73
Lend me a hand with this currently incorrect expression?!
« on: October 13, 2015, 07:03:09 pm »

I know the expression below is currently wrong (because it won't work), but I'm wondering what I need to do to make it right. I've tried a few things to no avail...

I have a smartlist full of my favorite tracks. I've determined the playlistid for this is 48710862. Now, how do I apply that info to the code here correctly?


ifelse(isequal([playlistid==48710862]), Favorite Tracks, 1, Not Favorite Tracks)
Logged

~OHM~

  • Citizen of the Universe
  • *****
  • Posts: 1825
  • "I Don't Play The Music The Music Plays Me"
Re: Lend me a hand with this currently incorrect expression?!
« Reply #1 on: October 13, 2015, 09:16:08 pm »

what is (ifelse)
Logged
“I've Reached A Turning Point In My Life. I Now Realize I Have More Yesterdays Then Tomorrows”

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9143
Re: Lend me a hand with this currently incorrect expression?!
« Reply #2 on: October 14, 2015, 12:05:55 am »

what is (ifelse)
It's an MC Expression function --> Click for more info

I know the expression below is currently wrong (because it won't work), but I'm wondering what I need to do to make it right. I've tried a few things to no avail...

I have a smartlist full of my favorite tracks. I've determined the playlistid for this is 48710862. Now, how do I apply that info to the code here correctly?


ifelse(isequal([playlistid==48710862]), Favorite Tracks, 1, Not Favorite Tracks)
Unfortunately, the expression engine will not work with playlist ids. We've asked on and off over the years, but nothing yet.

Could you come at it from the other end, perhaps? Let's find out...

What are the criteria for a files' inclusion in your smartlist? i.e., what makes a favourite, a favourite?
You could create a new, expression based library field called "Favourite Tracks" without the quotes, and then set the rule for the field so that if the file matches the rule set, MC will populate the field with either "Favourite Tracks" or "Not Favourite Tracks", and it would keep on doing this for you automagically as you add tracks.

Then you would have the library field [Favourite Tracks] available to you for use anywhere you liked within the program.

Let us know if you need any assistance with this....

-marko

EDIT:
Also, just in case you were wondering, other than the fact that it will never work, there's nothing else wrong with your expression format, other than perhaps a bit overkill for what you want.
Let's just say, for the sake of example, that the only rule for your smartlist is that [Rating] is greater than or equal to 4.

When you create your new library field, both of these will work:
ifelse(isequal([Rating],4,6), Favorite Tracks, 1, Not Favorite Tracks)

or

if(isequal([Rating],4,6), Favorite Tracks, Not Favorite Tracks)

"ifelse()" comes into its own when you want to nest a lot of "if()" statements. I had one with well over 40 "if()"s, and at the end, these all need to be closed off with 40 closing parenthesis, you know, like )))))))))))))))))))))))))))))))) and so on. With the "ifelse()" and the "!" mark to flip the result if required, all of that can be placed in a single "ifelse()" wrapper making everything a lot easier to follow.

The "6" in the two expressions above instruct the evaluator to compare for "greater than or equal to"

-marko

Saucepan

  • Junior Woodchuck
  • **
  • Posts: 73
Re: Lend me a hand with this currently incorrect expression?!
« Reply #3 on: October 14, 2015, 12:38:28 am »

Hi Marko thanks for replying.

I was aware of ifelse, and was planning on using MANY statements for the expression (maybe even 40!). I just wanted to know how to get playlistid going. But it looks like it won't work.

I'm basically trying to solve a bigger issue. The example I presented was just an easy way to make it clear that I wanted to incorporate playlistids into some expressions. I'll have to try another route.

---

What I'm trying to do, and I've been bugging ferday about this for a few days (poor guy!), is to try to create a variable that will take a field I've made, and assign an order to the values (1 for the highest value, 2 for the next highest and so on) that will change every time the list is refreshed.

It's basically a way to take my albums and say 'this one is #1, this one is #2, this one is #3 etc...Almost like a Seq for my records that changes every time I change a rating of a track.

The field is called LP Points. Thanks to ferday, who is amazing, I've got it working exactly how I want.

The last step of this whole thing is to list those values, top to bottom. I'm a huge fan of charts...

Any ideas you can add to this are extremely appreciated.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9143
Re: Lend me a hand with this currently incorrect expression?!
« Reply #4 on: October 14, 2015, 12:56:13 am »

Make sense? Yes.

"LP Points" ..... ? Hmmm.... I think I recall trying to read that and kind of glazing over ;)

Can you link to it and I'll have another read, though ferday knows his stuff, so don't be surprised if I can't add anything new. You never know though, fresh set of eyes and all that...

I'm off to sleep after posting this so will look later on...

-marko

Saucepan

  • Junior Woodchuck
  • **
  • Posts: 73
Re: Lend me a hand with this currently incorrect expression?!
« Reply #5 on: October 14, 2015, 01:12:08 am »

The link to the thread is here

http://yabb.jriver.com/interact/index.php?topic=100596.0

The 'establish an order' part of it started in private message.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Lend me a hand with this currently incorrect expression?!
« Reply #6 on: October 14, 2015, 10:37:37 am »

What I'm trying to do, and I've been bugging ferday about this for a few days (poor guy!), is to try to create a variable that will take a field I've made, and assign an order to the values (1 for the highest value, 2 for the next highest and so on) that will change every time the list is refreshed.

It's basically a way to take my albums and say 'this one is #1, this one is #2, this one is #3 etc...Almost like a Seq for my records that changes every time I change a rating of a track.

The field is called LP Points. Thanks to ferday, who is amazing, I've got it working exactly how I want.

The last step of this whole thing is to list those values, top to bottom. I'm a huge fan of charts...

I think what you're describing is SORTING based on the LP Points field.  Right?  So it's easy.  Create a new view (or use an existing one if you want).  Set the sorting to your LP Points field.  Done.  Am I missing something?

Brian.
Logged

Saucepan

  • Junior Woodchuck
  • **
  • Posts: 73
Re: Lend me a hand with this currently incorrect expression?!
« Reply #7 on: October 14, 2015, 02:15:27 pm »

It is sorting yes, but I want the field that we create to have a numerical value assigned to the sort. So, I can look at a file and MC will actually display what that value is (#1, #2, #956 etc).
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Lend me a hand with this currently incorrect expression?!
« Reply #8 on: October 14, 2015, 03:17:07 pm »

^ So you want a sequence number in your sort.  In your view that you create (and you should create a new one) go to Customize View.  Then:

Settings > included files > set rules for file display > Modify results > Add New modifier > sequence

Now you'll have a sequence number, starting to 1, next to every song.... and of course, in sorted order, so the sequence number is the "rank" according to your sort by LP Points.

Does that get you what you want?

Brian.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9143
Re: Lend me a hand with this currently incorrect expression?!
« Reply #9 on: October 14, 2015, 03:48:35 pm »

I looked at that too. I assumed that [LP Points] was an album specific field, so, going that way, the sequence increments by one for each track, so the first track of the second album in the list could for example, be assigned sequence number 15, when i think the desired number would be two.

I tried applying the sequence after limiting to one track from each album, then expanding to full albums. That causes the sequence column to populate with all zeros, though the sort order is preserved, so, switching the view to album thumbnails still gives you them in order, but...

This could also be easily achieved by sorting on the [LP Points] field anyway, so figured it to be completely not what Saucepan is after, and moved on...
Pages: [1]   Go Up