INTERACT FORUM

Please login or register.

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

Author Topic: Custom field and getting it to sort correctly  (Read 1144 times)

Raimy

  • Recent member
  • *
  • Posts: 31
Custom field and getting it to sort correctly
« on: November 18, 2012, 10:28:05 am »

Hi,

I'v been trying to create a custom field, a field which is similar to the "Last Played" and "Last Skipped" fields where the value will show the longest time since played/skipped which ever one is longest ago. This works fine, however this custom field will not sort like the "Last Played" field.

Dates are set to day-month-year on my pc and this below is typical of the values the field shows.

01/03/2012 13:00
01/04/2012 14:00
02/03/2012 13:00


It's clearly sorting the field like a numeric value. I assume i will need to tell the field it is to display dates and i'm not sure how to do that in the expression editor.

This is the calculated field contents. I stopped developing it when i noticed the problem, so i know it won't deal with "never played/skipped values. Can anyone tell me how i get the field to act like a date field when sorting?

Code: [Select]
ifElse(compare([Last Played,0],>,[Last Skipped,0]),[Last Played],
compare([Last Skipped,0],>,[Last Played,0]),[Last Skipped])





Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Custom field and getting it to sort correctly
« Reply #1 on: November 18, 2012, 02:49:34 pm »

Try this:

FormatDate(ConvertDate(if(compare([Last Played,0],>,[Last Skipped,0]),[Last Played],[Last Skipped])),Year//MM//dd HH:mm)
Logged
The opinions I express represent my own folly.

Raimy

  • Recent member
  • *
  • Posts: 31
Re: Custom field and getting it to sort correctly
« Reply #2 on: November 18, 2012, 06:30:08 pm »

Much appreciated! thx.
Logged
Pages: [1]   Go Up