INTERACT FORUM

Please login or register.

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

Author Topic: Wrong sort order for calculated fields  (Read 1644 times)

ChrisRainman

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 306
  • nothing more to say...
Wrong sort order for calculated fields
« on: May 13, 2009, 07:44:53 am »

I created a calculated field named "Playback score". The numeric value is determined by a math function composed by different fields like number plays, last played, rating etc.
After each play the field gets updated.

I have created some view schemes in which I sort songs by that playback score. The numeric values are sorted correctly as long as they have not been played. After playing a song the value is 0 and increases each day. Songs that have not been played yet have higher values. The sorting sequence after some songs have been played is as follows:

0         (played today)
0         (played today)
45        ( played yesterday)
45        ( played yesterday)
45        ( played yesterday)
12000   - not played since field exists
11500   - not played since field exists
11000   - not played since field exists

The sort order of this field is playback ranking (z-a).

Also conspicious is the fact that this field seems to be typed as string. When using the calculated field in rules, the possible operators are "is", "is not", ... instead of <,>,<=,=...

Shouldn't calculated fields always be in numeric style?

Logged

ChrisRainman

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 306
  • nothing more to say...
Re: Wrong sort order for calculated fields
« Reply #1 on: May 14, 2009, 02:46:50 am »

No comments on this? Is it understandable what is my point?
Logged

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4580
Re: Wrong sort order for calculated fields
« Reply #2 on: May 14, 2009, 07:29:53 am »

im not sure about the sorting..

but to comment on:
Code: [Select]
Shouldn't calculated fields always be in numeric style?
i think the answer is no. calculated fields can be used for texts also, actuallt until recently that was more or less the only thing it could be used for.
an example is the standard artist-album(year) field.

but i agree that when numbers are used they should be recognised that way.

maybe you could post the expression used?

 :)
gab
Logged

ChrisRainman

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 306
  • nothing more to say...
Re: Wrong sort order for calculated fields
« Reply #3 on: May 15, 2009, 05:29:21 pm »



maybe you could post the expression used?

 :)
gab

ok, here's my expression (might look a bit weird...)

IF(ISEQUAL([Last Played],n,8), 100000,  MATH(POW([Preference-4],2)*[Rating]* (FormatDate(Now(),yyyy)*360   +FormatDate(Now(),MM)*30   +FormatDate(Now(),dd)      -(FormatDate([Last Played,0],yyyy,1)*360   +FormatDate([Last Played,0],M,1)*30   +FormatDate([Last Played,0],dd,1) //[Number Plays] )))

The FORMATDATE section calculates the number of days since a song's last play. I think it's not important to understand the expression but the result it produces. This normally is a value between 0 and 100.000.

The sort order of this field is never updated! When using it in view scheme expressions it shows up us taxt data type (see my statement below)
Logged

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4580
Re: Wrong sort order for calculated fields
« Reply #4 on: May 16, 2009, 03:03:59 am »

with never updated you mean also after hitting refresh... because sort orders are never updated (try for instance number plays) without refresh or leaving a view.
i just tried with a simple calculation, and sorting updates fine after a refresh.
Logged
Pages: [1]   Go Up