INTERACT FORUM

Please login or register.

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

Author Topic: Creating a field (using expression)  (Read 8524 times)

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Creating a field (using expression)
« on: September 05, 2013, 09:59:04 am »

Want to create an a field expression.
Is like the field from spotify player, called popularity, where it have vertical bar, wich mean, how a popular track it is. EX: ||||||||||
I already created a field with value, from 0 to 20, where if a track is played it get an number of plays.
Value is: 0=0; 1-2=|; 3-4=||; 5-6=|||; 7-8=||||; 9-10=|||||; 11-12=||||||; 13-14=|||||||; 15-16=||||||||; 17-18=|||||||||; 19-20=||||||||||.
My goal is to create that field where the 10 bars (is my purpose limit) will be filled with the number of played converted in the number of bars till it will be full;
Ex: track with zero play it is  ||||||||||;, the next track is 5 time played wich converted in |||, that mean ||||||||||, but when the number of plays is on the portion of green bars to become the rest of the number of ten.
 That mean when a song is played 20 times, bars will be all red color ||||||||||. I did try severel method to apply this to my creation but at the end i fail to do, because each, time when i add tracks with played time, the vertical bar instead of adding red/green in 10 space limit will add more and that exceed the idea.
When come to make a complex expression my experience is almost zero to none, so i hope someone with great mind it will be able to help me find a way to create.
Thanks in advice.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (spotify mode of popularity)
« Reply #1 on: September 05, 2013, 12:00:38 pm »

This is a simple mapping, where you want to go from one value to another, and output a certain number of red characters based on the results of that mapping, and then output the "opposite" number of green characters:

   n red followed by 10-n green

Your values are:

   0,0  -->  0
   1,2  -->  1
   3,4  -->  2
   5,6  -->  3
   7,8  -->  4
  9,10 -->  5
11,12 -->  6
13,14 -->  7
15,16 -->  8
17,18 -->  9
19,20 --> 10

To go from your values to the number of characters, we use some math:

    round ( value / 2 )

e.g.

    round (11 / 2)
    round (5.5)
    6

Math() can do this for us, but we have to use a plus .5 and truncate technique (in MC 18):

    math(v=11 / 2 + .5; v - (v %1))

And the "opposite" value is essentially 10 - result.  This gives us our two numbers, which are the values we want to use for red and green characters.  And we can ask Mid() to supply us with a certain number of characters from a string.  First we'll output the n red characters, and then output the 10-n green characters:

<font color="ff0000">mid(||||||||||, 0, math(v=[_a] / 2 + .5; v - (v %1)))<//font><font color="00ff00">mid(||||||||||, 0, math(v=[_a] / 2 + .5; 10 - (v - (v %1))))<//font>

Change the field [_a] above with your field.

You might want to use a larger character too.  See attached using the ▬ character.

Keywords Track Rating Bars Pipe Stars
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (spotify mode of popularity)
« Reply #2 on: September 05, 2013, 02:14:40 pm »

First of all. thank you MrC you are a genius on this matter, but i think i did a minor mistake about some info, my field created it has value from 0;1;1.5;2;2.5;3;3.5;4;4.5;5;5.5;6;6.5;7;7.5;8;8.5;9;9.5;10, where:
0=0
1-1.5=1
2-2.5=2
3-3.5=3
4-4.5=4
5-5.5=5
6-6.5=6
7-7.5=7
8-8.5=8
9-9.5=9
10and beyond=10
And each number correspond to one vertical bar, now my question is how to modified the expression to correspond to my value because i see something that don't fit well.
I think you divided the number from 1-20, my mistake.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (spotify mode of popularity)
« Reply #3 on: September 05, 2013, 02:25:00 pm »

No problem:

<font color="ff0000">mid(▬▬▬▬▬▬▬▬▬▬, 0, math(v=[_a]; v - (v %1)))ifelse(compare([_a], <, 10),<font color="00ff00">mid(▬▬▬▬▬▬▬▬▬▬, 0, math(v=[_a]; 10 - (v - (v %1))))<//font>)
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (spotify mode of popularity)
« Reply #4 on: September 07, 2013, 04:35:12 pm »

Is working as intended and thank for the help but got one more favor can this be apply for rating album, the field have this value, 0;1;1.5;2;2.5;3;3.5;4;4.5;5 (1.5;2.5;3.5;4.5 represent the half stars).
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (spotify mode of popularity)
« Reply #5 on: September 07, 2013, 07:59:04 pm »

How many total stars to you want to see - 5?

And what do you want to do with the half-stars: 3 1/2 stars, for example.  Should 3 stars and 1 half-star-symbol be red, and 1 and star and 1 half-star-symbol be green?   That would be a total of 6 characters, and this won't align well with ratings that don't have 1/2 stars since they will have only 5 characters.
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: Creating a field (spotify mode of popularity)
« Reply #6 on: September 07, 2013, 08:20:58 pm »

Well, just to get ahead of myself, maybe you want something like this:

<font color="ff0000">listitem(;½;★;★½;★★;★★½;★★★;★★★½;★★★★;★★★★½;★★★★★, math([album rating] * 2))<//font>/
<font color="00cc00">listitem(★★★★★;★★★★½;★★★★;★★★½;★★★;★★½;★★;★½;★;½;, math([album rating] * 2))<//font>
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (spotify mode of popularity)
« Reply #7 on: September 08, 2013, 04:08:11 am »

Your expression it seems is not ad up well, instead remain 5/5 (with or without half stars) it adds so is become from 4.5 stars 6 stars, and so on. This happens only when it meet half stars.
Can it be done in a way that the stars stick to 5/5 either if it is with half star?
I did try to walkaround with your expression, but no chance to get what i want.
My expression is
<font size="110%"><font color="0e76bc">mid(, 0, math(v=[Album.Rating]; v - (v %1)))ifelse(compare([Album.Rating], <, 5),<font color="bdbdbd">mid(, 0, math(v=[Album.Rating]; 5 - (v - (v %1))))<//font>)<//font> but i can't add or don't know how to add half stars in this expression.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (spotify mode of popularity)
« Reply #8 on: September 08, 2013, 12:10:00 pm »

You can use my expression above, but just replace the 1/2 symbols in the expression with whatever star value you want shown.  And if you don't want the green 1/2 star, just remove it, leaving its placeholder as empty.  Example:

<font color="ff0000">listitem(;½;★;★½;★★;★★½;★★★;★★★½;★★★★;★★★★½;★★★★★, math([album rating] * 2))<//font>/
<font color="00cc00">listitem(★★★★★;★★★★;★★★★;★★★;★★★;★★;★★;★;★;;, math([album rating] * 2))<//font>

Using the technique above, you don't have to use complicated math - instead, you're just creating a list of values you want for each side (the red and green sides).  Position 0 in the first list and position 10 in the second list map to the value 0 red stars / 5 green stars.  The mapping is just your album rating * 2 (to make the .5 fraction into a whole number).
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (spotify mode of popularity)
« Reply #9 on: February 23, 2014, 12:43:52 pm »

Hello MrC. Sorry for disturbing you but i want to ask/help me you something.
For some time i have in my head some idea to implement some kind of play number in an album. So far what i made is kinda wrong because if you have an album template as a trucks play/album is not match to all, because some albums have more or less than you can make a optimal solution. As for tracks is very simple they are 1 so you can work from that.
But as for albums, they can have from 10-20 tracks/album and a good solution in on the middle. Now if i want to add this to all the albums some will don't count the play numbers because they have much more tracks than the other album.
Example: If one album have 10 tracks and a total of 20 plays (tracks) and second album have 15 tracks and the same play as the first, here is lay the problem. What i did is what i create for tracks i did the same for albums, but like i say above there lay the problem with number of tracks in one album. My system of rating album plays is from 1-10 where each number represent a "|".
Where n number plays represent a number from 1-10 and there is represented by "|"
So for one album with the same play but with less tracks have more "|" than other album where have more than the one before.
A solution i thinking it is to make an middle way where i make for all albums a fixed number of tracks but that mean some will have more or less playing because of this solution.
So far nothing help me so i come to you because i know you have more experience than me with this kind of stuff.
I hope you understand what i have in my mind and if you desire to help me on this
Thx again for the effort.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (spotify mode of popularity)
« Reply #10 on: February 23, 2014, 01:15:25 pm »

Hi Sirgio,

It sounds like you want a weighted average Album Popularity rating, which scales the average track rating per album by the largest number of tracks per album.

So an album with 20 tracks, each rated at 5, would weight higher than an album with 10 tracks rated at 5, which would rate higher than an album with 2 tracks each rated 10.  See screenshot.

I'm I understanding correctly?
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (spotify mode of popularity)
« Reply #11 on: February 23, 2014, 02:04:44 pm »

Dunno what is better, to get a 20 or 15 tracks as a standard.
I suppose 15 because majority of albums are at this sum. Maybe you have another better idea.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (spotify mode of popularity)
« Reply #12 on: February 23, 2014, 02:43:43 pm »

The 20 was just an example of some collection I made up.  The actual number would be the largest number of tracks available for all your albums.  If you don't use this number, than some ratings could be > 10, or you're just going to have to toss out some tracks.

What you need to do is figure out whether the numbers like I show above make sense to you and are meaningful.  I personally don't find these single-number metrics to be of any value at all.
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (spotify mode of popularity)
« Reply #13 on: February 23, 2014, 03:08:13 pm »

So that depend on the number of tracks and not a fixed number?!
If some album have more than 20+ how it suppose to deal with it? Why i want to use this kind of thing because sometimes is easy to see which album have more playing than others, like that what you create for tracks.
Not all like the same thing so :D
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (spotify mode of popularity)
« Reply #14 on: February 23, 2014, 04:46:06 pm »

I think you were misunderstanding.  The 20 I selected was just an example.

So that depend on the number of tracks and not a fixed number?!

Right.

The actual number that would be used would be the album with the greatest number of tracks in your collection.  Think about it.  If you have 1 album with 1000 tracks, all rated as 10, then you'd expect this album would be your very best.  Even if all the tracks were rated at 8, that album would rate higher than a single album with 2 tracks rated as 10, because it has a higher "weight".

I think I was confused earlier, because somehow I injected "rating" when you are focused on play counts. So you really just want an average play count, or a weighted average play count.  Either way, its the same concept, but using play counts instead of rating.
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (spotify mode of popularity)
« Reply #15 on: February 23, 2014, 04:57:36 pm »

Only play count, i don't care about rating, already have some kinda rating for album so i will want it for play counts.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (spotify mode of popularity)
« Reply #16 on: February 23, 2014, 05:24:01 pm »

So how these numbers feel to you?  See attached:
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (spotify mode of popularity)
« Reply #17 on: February 24, 2014, 03:33:55 am »

Can this number be lower like say 20/20/30?
Right now i have no idea how this number will do on my albums, so i say start with lower numbers and see how it work.
Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (spotify mode of popularity)
« Reply #18 on: February 24, 2014, 04:22:51 am »

Here is an example of my biggest number of plays in albums, maybe this make you some idea. Biggest number is above 200.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (spotify mode of popularity)
« Reply #19 on: February 24, 2014, 12:01:37 pm »

Can this number be lower like say 20/20/30?

What "number" are you referring to?

All the numbers shown in the spreadsheet were *example* numbers of actual data you might have.  Of course any expressions will use your own data.  The point of showing you the results using the example data was to determine if this is what you were looking for.

I suppose I don't really understand what you're looking for.  Or worse, that you don't either! :-)
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (spotify mode of popularity)
« Reply #20 on: February 24, 2014, 12:42:46 pm »

I was referring about that spreadsheet when i say numbers, i was thinking that way work so maybe now you got it :)
Maybe was my mistake when i did point on that. I know what i want to make but maybe we have some miss understood conversation.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (spotify mode of popularity)
« Reply #21 on: February 25, 2014, 03:26:09 pm »

So you are saying you are happy with the formula and results shown in Reply #16?
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (spotify mode of popularity)
« Reply #22 on: February 25, 2014, 03:38:50 pm »

Is not about happy or sad here :P because i don't know how will this be apply so if you think a way just show me and see what face i can make after  ;D or :-\.
Let say that what you show me can be a start. (Not confusion anymore :D)
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (spotify mode of popularity)
« Reply #23 on: February 25, 2014, 03:42:28 pm »

Its a figure of speech, meaning "satisfied".

I think it is up to you to decide what you want; you're asking me to figure that out for you, and if you're not satisfied, I have more work to do.  I'm happy to help, but I can't do all the work for you.  Minimally, you could create a spreadsheet and play with some numbers, and see if the results are satisfactory.
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (spotify mode of popularity)
« Reply #24 on: February 25, 2014, 04:47:04 pm »

In hell no, that wasn't my idea. The problem is this. A few early version when you have this expression: "FormatNumber([Number Plays, 0], 1, never, , )" it showed a fractional number like say 1.3; 0,4 and so on, but now on that expression it show you all the number play on albums and i think something changes in the meantime. My early expression was this: from 0 to 10 with (.5) increment, and from there i added manually for each albums.
Now this didn't work too good because when a album have the same number of plays but different number of tracks it doesn't fit in that expression too well.
Let say if on album with 15 tracks have 1.3 (as the early version show) the value was |, but when another album have the same number of plays that expression wasn't the same as 1.3 and was lower because of the number of tracks. So here is my main issue, and wanted to do something or to find a way to have a middle solution.
And knowing that you are more expert than me on this expression i can have a chance to help me here. But if is too much to work i don't want to put you in a position you don't like so i rather stop asking for help.
I put some spreadsheet to understand me better as old format and new format.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (spotify mode of popularity)
« Reply #25 on: February 25, 2014, 05:46:40 pm »

...The problem is this. A few early version when you have this expression: "FormatNumber([Number Plays, 0], 1, never, , )" it showed a fractional number like say 1.3; 0,4 and so on, but now on that expression it show you all the number play on albums and i think something changes in the meantime.

It took me a while to figure out what you are saying here.  (you tend to leave off very important details, like exactly WHERE you see this problem.  Also, be specific, instead of using non-specific terms like "it" - remember, others cannot "see" what you see on your screen.).   But, yes, in MC 19.0.92, there was this change:

Quote
19.0.92 (12/11/2013)
2. Changed: When summarizing data in a group of files, the 'Number Plays' and 'Skip Count' fields are totals instead of averages.

And this will affect thumbnail text or groups.

My early expression was this: from 0 to 10 with (.5) increment, and from there i added manually for each albums.
Now this didn't work too good because when a album have the same number of plays but different number of tracks it doesn't fit in that expression too well.
Let say if on album with 15 tracks have 1.3 (as the early version show) the value was |, but when another album have the same number of plays that expression wasn't the same as 1.3 and was lower because of the number of tracks. So here is my main issue, and wanted to do something or to find a way to have a middle solution.

I think this part has been made clear.  I get that you want something different.

I put some spreadsheet to understand me better as old format and new format.

Your spreadsheet is good.  It shows a mapping of total track play counts to a 0 to 10 score.  The only question that remains.  Where did the "200" Play Count value come from.  Is that a value you arbitrarily selected, or do you want it to be Calculated from something?  If so, from what - the largest value of total track play counts in your collection?

Either way, this seems different than what I thought you were asking about above, and what my spreadsheet shows.  Your spreadsheet seems to be taking your largest number of total play counts for an album, and breaking that value into 11 buckets, each equal size, and placing each album into one of the buckets according to its total track play count.  In your example, your formula is simple Total Track Play Count for an Album / 20.
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (spotify mode of popularity)
« Reply #26 on: February 26, 2014, 08:53:17 am »

Here is what i thought and create. This is from my music library.
In that spreadsheet you will find a number of albums with how many tracks have on, to get an idea.
The other spreadsheet is what i thought is good to do, choosing as a standard of 5/10/15/20/25 and above as per tracks/album. My biggest playcount on album have over 200 plays so i take this a reference as the biggest value. and from there i divide in 20 where "|" mean - 20 play counts. The rest don't know yet, as maybe will discover in future.
Thx for the effort.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (spotify mode of popularity)
« Reply #27 on: February 26, 2014, 06:18:19 pm »

Ok, let's try this.  Add this to your Set rules for file display:

[=1save(0,albumkey()_ttpc)]=1 [=1saveadd(albumkey()_ttpc, [number plays])]=1

Add this column to your view as an expression column (copy/paste):

mid(▬▬▬▬▬▬▬▬▬▬, 0, Math(min(10,load(albumkey()_ttpc) / 20)), -1) : Math(min(10,load(albumkey()_ttpc) / 20))
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (spotify mode of popularity)
« Reply #28 on: March 01, 2014, 02:00:30 pm »

So i finally put this expression on work today, and seems ok. Don't know what else to told just THANK YOU!.
I will try to play with the expression a little bit to see how much or few can do with it.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (spotify mode of popularity)
« Reply #29 on: March 01, 2014, 02:25:55 pm »

Great, thanks for the update.
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (spotify mode of popularity)
« Reply #30 on: March 01, 2014, 02:46:21 pm »

One question?
Code: [Select]
[=1save(0,albumkey()_ttpc)]=1 [=1saveadd(albumkey()_ttpc, [number plays])]=1This is require as to display because i saw that it works without it.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (spotify mode of popularity)
« Reply #31 on: March 01, 2014, 02:57:24 pm »

Yes, it is required in the view.  It has to run at least once.  After it has run, the global variables will remain active in MC until you quit.

It appears to you it is not necessary, because it has already done its work.  Remove it, quit MC, and you'll find the expression field/column no longer works.
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (spotify mode of popularity)
« Reply #32 on: March 01, 2014, 03:27:19 pm »

Ok i understand that
Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (using expression)
« Reply #33 on: March 23, 2014, 02:46:31 pm »

I've come here again with another expression, who kinda put me in the position to ask for some help.
So i created some expression using Dynamic Range (DR128) and Dynamic Range (DR), where each song have a fixed range of numbers. I sum all this numbers in a range from 1-5 for Dynamic Range (DR), and for the other one i put from A-E for Dynamic Range (DR128).
Here is the expression:
Dynamic Range (DR)
Code: [Select]
save(replace(GroupSummary([Dynamic Range (DR)]), / avg,),avgrating)/ ifelse(     Compare([Dynamic Range (DR)], =, 0), ,     Compare([Dynamic Range (DR)], <=, 5), A,   Compare([Dynamic Range (DR)], <=, 10), B,     Compare([Dynamic Range (DR)], <=, 15), C,   Compare([Dynamic Range (DR)], <, 20), D,     Compare([Dynamic Range (DR)], =>, 20),           ,    1, E )Dynamic Range (DR128)
Code: [Select]
save(replace(GroupSummary([Dynamic Range (R128)]), / avg,),avgrating)/ ifelse(     Compare([Dynamic Range (R128)], =, 0), ,     Compare([Dynamic Range (R128)], <=, 5), 1,   Compare([Dynamic Range (R128)], <=, 10), 2,     Compare([Dynamic Range (R128)], <=, 15), 3,   Compare([Dynamic Range (R128)], <, 20), 4,     Compare([Dynamic Range (R128)], =>, 20),           ,    1, 5 )Then i combine this 2 expression in one expression and for each dynamic range and are from A1-A5; B1-B5; C1-C5; D1-D5; E1-E5.
My purpose is that each of this A1, A2, A3, A4, A5 and so on to have a distinct color, so i create another fields (total of 25) and assign a unique color.
Till here things goes ok, now my problem is this. I want to create another field where this color to show up as that unique color, and that mean, i need to combine all this 25 fields in one field, and only to show me that designated color.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (using expression)
« Reply #34 on: March 23, 2014, 03:13:27 pm »

Are your A1, A2, ..., E4, E5 values going to be combined and used as HTML font color attributes?
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (using expression)
« Reply #35 on: March 23, 2014, 04:06:12 pm »

Yes
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (using expression)
« Reply #36 on: March 23, 2014, 04:47:00 pm »

Ok, got it.  Maybe you're just working out the details now, but the values you're using are not likely to give you good results, since they are very close in color-proximity.  For example, can you really tell the difference between C40000 and C50000?

If you're trying to map two values into a color space, you're better off using one RGB component for one value, and other one for another value, like R for Dynamic Range (DR128) and B or G for Dynamic Range (DR).

Since you're only mapping 25 values, I would decide what colors I wanted to use when DR is 0 and DR128 is not, vice versa, and both 0.  Then decide how to map values all the way up to full values (like FF).

With small numbers of items, you can create a lookup table for finding your colors values.  Your 0 to 25 values can be used as listitem() indexes, where the list contains the 25 color values.

If both Dynamic Range R128 and DR values have maximum values, you can probably use that fact along with some smart Math() to calculate the ranges you'll use for the table lookup.  And a table lookup I've shown you in some other thread regarding presenting a number of stars and half-stars.


Your functions currently have some problems.  I'm assuming these are being used for thumbnail text (but I'm not sure of this).

save(replace(GroupSummary([Dynamic Range (DR)]), / avg,),avgrating)/
ifelse(
    Compare([Dynamic Range (DR)], =, 0), ,
    Compare([Dynamic Range (DR)], <=, 5), A,
    Compare([Dynamic Range (DR)], <=, 10), B,
    Compare([Dynamic Range (DR)], <=, 15), C,
    Compare([Dynamic Range (DR)], <, 20), D,
    Compare([Dynamic Range (DR)], =>, 20),           ,
    1, E )

save(replace(GroupSummary([Dynamic Range (R128)]), / avg,),avgrating)/
 ifelse(     
    Compare([Dynamic Range (R128)], =, 0), ,
    Compare([Dynamic Range (R128)], <=, 5), 1,
    Compare([Dynamic Range (R128)], <=, 10), 2,
    Compare([Dynamic Range (R128)], <=, 15), 3,
    Compare([Dynamic Range (R128)], <, 20), 4,
    Compare([Dynamic Range (R128)], =>, 20),   ,
    1, 5 )


Problem 1. The GroupSummary() functions takes the names of fields as arguments, without brackets.  In thumbnail text, you must use forward slash to escape parens, which are part of the field name.  The following is the correct usage:

   GroupSummary(Dynamic Range /(DR/))

Problem 2. This portion of your expresssions:

       Compare([Dynamic Range (R128)], =>, 20), ,

doesn't make sense, as the => is incorrect.  You want >= if you mean Greater than or Equal to.   But you're also assigning no value here (the else part of the ifelse is empty), so if you did mean  >=, nothing at or above 20 would get a value.  And yet, your next part assigns a 5, and yet it should never be reached.  Maybe you added this because the => problem?

Problem 3.  Maybe not.  You're saving two different values into the global variable, and since you're not using it in the expressions, I'm not sure what you're trying to do here, esp. since in one part of the expression you're using the GroupSummary() value, but in the other using the singular value (but at a group level like thumbnail?).
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (using expression)
« Reply #37 on: March 23, 2014, 06:08:49 pm »

Compare([Dynamic Range (R128)], =>, 20), ,

If u use otherwise is not show what is 20 or greater, i tested that and that way it works, so is not wrong, at least what it show me.
Mainly i use for thumbnail mode and list as well.
I didn't know that RGB can be apply to the this so i used what i find and know about it.
Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (using expression)
« Reply #38 on: March 23, 2014, 06:30:59 pm »

A few things.
The group fields i didn't used so far in thumbnail and when i try it only show ..., the other issue, is this, if i remove the brackets from group summary is not show nothing so i get back with brackets.
So that 2 fields i use to collect in one field the information within, like i say above in the post. A1, etc.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (using expression)
« Reply #39 on: March 23, 2014, 06:45:53 pm »

If u use otherwise is not show what is 20 or greater, i tested that and that way it works, so is not wrong, at least what it show me.
Mainly i use for thumbnail mode and list as well.

I don't think you're understanding.  Look at the attached screenshot.
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (using expression)
« Reply #40 on: March 23, 2014, 07:02:38 pm »

Then something is wrong and we have a conflict here, because mine showing this.
Look at my SS. I try it both so i can tell you that brackets works other nope.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (using expression)
« Reply #41 on: March 23, 2014, 07:11:17 pm »

We're not talking about brackets here.  It is about YELLOW stuff in my screenshot.
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Creating a field (using expression)
« Reply #42 on: March 23, 2014, 07:25:21 pm »

Hmmm! Maybe i don't understand but you say above this:
"Problem 1. The GroupSummary() functions takes the names of fields as arguments, without brackets.  In thumbnail text, you must use forward slash to escape parens, which are part of the field name.  The following is the correct usage:

   GroupSummary(Dynamic Range /(DR/))

Problem 2. This portion of your expresssions:

       Compare([Dynamic Range (R128)], =>, 20), ,"
So if i remove brackets from my expression it will not show me what is above 20 or equal, but if i keep brackets it show me.
BTW do you use this expression in thumbnail?! because i use only to calculate my fields.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Creating a field (using expression)
« Reply #43 on: March 23, 2014, 08:29:21 pm »

You're mixing up the two problems.

Problem 1 was was about GroupSummary(), which uses a non-bracketed field name.

Problem 2 was about an incorrect usage of => instead of >=, as shown in the screenshot.
Logged
The opinions I express represent my own folly.
Pages: [1]   Go Up