INTERACT FORUM

Please login or register.

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

Author Topic: Rating Pane Help..  (Read 1963 times)

locust

  • Citizen of the Universe
  • *****
  • Posts: 699
Rating Pane Help..
« on: December 04, 2011, 06:03:50 am »

Hi I am just curious about something

I have two rating panes in all my views, one for rating the tracks & the other for rating the album.. I have been considering a third for artist but it wouldn't work correctly with my setup as I use ";" delimiters to separate the artists..

Well anyway I have two panes both dealing with ratings.. I was wondering can I somehow merge the two panes using expressions.. I'd like to call the pane Ratings.. Then below would appear the title Track Ratings with the stars nested beneath that. Then below those stars it would say Album Ratings and again it would show the stars nested below..

I never really use both rating panes at the same time anyway so I would prefer them to be merged.. They both deal with basically the same thing so I don't see why not. Also it won't be overkill in comparison to combining (I know it doesn't make sense but it is all I can think of) an Album Artist list and an Album List one after the other. The list it will only ever have a maximum of 17 entries considering the titles, the 10 entries for album ratings and the five for tracks.. I remember reading somewhere on the forum about using a line break in the expression editor but I can't remember if that has anything to do with this or if it is just to break up code..

Here is the code I use for the two separate panes.
Mid(★★★★★, 0, [{Album Rating}])If(IsEqual(Right([{Album Rating}], 2), .5), ☆, )
Mid(★★★★★,0,[Rating])

I hope this is possible it would nicely tidy up my views a little

Thanks
Logged

locust

  • Citizen of the Universe
  • *****
  • Posts: 699
Re: Rating Pane Help..
« Reply #1 on: December 04, 2011, 06:08:14 am »

Suppose I could just do it with a smartlist.. It'd be nice to know if it is possible with expressions anyway.. Probably better with the expressions if possible because if there were no tracks rated 2 then the list wouldn't show a 2 star entry and the smartlist solution would show all stars..

Thanks
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Rating Pane Help..
« Reply #2 on: December 04, 2011, 11:23:42 am »

You can place line breaks or extra white space *after* a comma.  The following are equivalent:

  if(test, a, b)

  if(test,
      a,
      b)

For your nesting, use listbuild() and set the datatype to list.  Here's your expression - you can copy/paste it into the expression editor:

Listbuild(1, \,
   Mid(★★★★★, 0, [{Album Rating}]),
   If(IsEqual(Right([{Album Rating}], 2), .5),
      ☆,
      Mid(★★★★★,0,[Rating]))&datatype=[list]
Logged
The opinions I express represent my own folly.

locust

  • Citizen of the Universe
  • *****
  • Posts: 699
Re: Rating Pane Help..
« Reply #3 on: December 04, 2011, 12:22:39 pm »

Thanks MrC
That's quite interesting... I was hoping you could clearly separate the two in the same pane and not nest them, I guess not.. Looks quite cool that way though, although I'm not sure if I could get use to it that way and I'm not sure which one I would prefer to be nested.. Conundrum  ?

I was looking at the new build updates could you tell me what the ! operator is for?? The expression wiki hasn't been updated and I was wondering what I could use it for..

Thanks
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Rating Pane Help..
« Reply #4 on: December 04, 2011, 12:39:23 pm »

Thanks MrC
That's quite interesting... I was hoping you could clearly separate the two in the same pane and not nest them, I guess not.. Looks quite cool that way though, although I'm not sure if I could get use to it that way and I'm not sure which one I would prefer to be nested.. Conundrum  ?
Sure.  How about separating them, by say, --- :

Mid(★★★★★, 0, [{Album Rating}]) ---  If(IsEqual(Right([{Album Rating}], 2), .5),
      ☆,
      Mid(★★★★★,0,[Rating]))

You can do some math() and add some padding to line up the location of the groups if you wanted.

I was looking at the new build updates could you tell me what the ! operator is for?? The expression wiki hasn't been updated and I was wondering what I could use it for..

Actually, the Wiki has been updated - I did it last night.  See the Conditionals section text, and If() statement example.  Here's an example of why I requested NOT:

Quote from: MrC
The new IfElse is nice, but is limited without the ability to negate an expression.  The template expression:

   If(t1, r1, If(t2, r2, If(t3, r3)))

translates nicely into:

   IfElse(t1, r1, t2, r2, t3, r3).

and this works fine when the chain of tests wants to retest in the ELSE clauses only.

An if/else sequence such as the following cannot be naturally translated into the simplified IfElse chain:

Code: [Select]
if (t1) {
if (t2) {
  r2
}
else {
if (t3) {
}
else {
r3
}
}
}
else {
}

But by negating the t1 and t3 values, the code can fit the IfElse flow:
Code: [Select]
if (! t1) {
}
else {
if (t2) {
  r2
}
else {
if (! t3) {
r3
}
else {
}
}
}

Allowing for:

   IfElse(!t1, , t2, r2, !t3, r3)
Logged
The opinions I express represent my own folly.

locust

  • Citizen of the Universe
  • *****
  • Posts: 699
Re: Rating Pane Help..
« Reply #5 on: December 04, 2011, 08:39:48 pm »

Thanks MrC it's getting there. That look a whole lot better...

Is there a way to make it display like this

Track Ratings

★★
★★★
★★★★
★★★★★
Album Ratings

★☆
★★
★★☆
★★★
★★★☆
★★★★
★★★★☆
★★★★★
★★★★★

Or Like this

Track Rating - ★
Track Rating - ★★
Track Rating - ★★★
Track Rating - ★★★★
Track Rating - ★★★★★
Album Rating - ★
Album Rating - ★☆
Album Rating - ★★
Album Rating - ★★☆
Album Rating - ★★★
Album Rating - ★★★☆
Album Rating - ★★★★
Album Rating - ★★★★☆
Album Rating - ★★★★★
Album Rating - ★★★★★

Is this possible or is your expression as far as I can go concerning this?

Thank you

I'm going to have to think of some uses for the if else... Is there anything you can do that you couldn't before with it? Or will it just allow me to make some of my more complicated expressions more simplistic?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Rating Pane Help..
« Reply #6 on: December 04, 2011, 08:49:30 pm »

Sure.

Track Rating - Mid(★★★★★, 0, [Rating]);Album Rating - Mid(★★★★★,0,[{Album Rating}])/##/If(IsEqual(Right([{Album Rating}], 2), .5), ☆, )&datatype=[list]

In the expression language, placing a semicolon in the output, and then coercing the datatype to list, creates separate entries. Alternatively, you can use ListBuild to join the items:

ListBuild(1, ;,
    Track Rating - Mid(★★★★★, 0, [Rating]),
    Album Rating - Mid(★★★★★, 0,
        [{Album Rating}])/##/if(IsEqual(Right([{Album Rating}], 2), .5), ☆,))&datatype=[list]

I didn't bother to remove the empty entries.

Also, I realize the earlier expression is not quite correct - your original post had Album Rating and Rating reversed.  The expression posted in this thread fixes that.

Edit: Fixed expression.
Logged
The opinions I express represent my own folly.

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Rating Pane Help..
« Reply #7 on: December 04, 2011, 08:58:56 pm »

I'm going to have to think of some uses for the if else... Is there anything you can do that you couldn't before with it? Or will it just allow me to make some of my more complicated expressions more simplistic?

Use it whenever you have a bunch of nested IF statements.  Think of it when you have something like:

  if [media type] == Video
    do video stuff
  else if [media type] == Audio
    do audio stuff
  else if [media type] == Image
    do image stuff
  else
    do else stuff

as it will translate into:

  IfElse(isequal([media type], Video),
       do video stuff,
    isequal([media type], Audio),
       do audio stuff,
    isequal([media type], Image),
       do image stuff,
    1,
       do else stuff)
Logged
The opinions I express represent my own folly.

locust

  • Citizen of the Universe
  • *****
  • Posts: 699
Re: Rating Pane Help..
« Reply #8 on: December 04, 2011, 09:16:23 pm »

Thanks MrC

But I seem to be having one little problem with  it..  The track rating it working fine but the Album Rating is only showing two entries

Album Rating -
Album Rating - ☆
   
I'm not sure what is causing it..

Thanks
Logged

locust

  • Citizen of the Universe
  • *****
  • Posts: 699
Re: Rating Pane Help..
« Reply #9 on: December 04, 2011, 09:38:44 pm »

Never mind MrC got it working, here is my finished expression that also ignores entries that aren't rated..

if(isequal([Rating],1,6),TR - Mid(★★★★★, 0, [Rating]),);if(isequal([{Album Rating}],1,6),AR - Mid(★★★★★, 0, [{Album Rating}])If(IsEqual(Right([{Album Rating}], 2), .5), ☆, ),)&datatype=[list]

Thanks for your help :)
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Rating Pane Help..
« Reply #10 on: December 04, 2011, 09:40:33 pm »

Sorry, I assumed your original expression was correct generally.  I should have tested it better.  I had a typo also, which exchanged [ and {.

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