INTERACT FORUM

Please login or register.

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

Author Topic: Search Language Special Sort Sequence  (Read 514 times)

vbphil

  • World Citizen
  • ***
  • Posts: 133
Search Language Special Sort Sequence
« on: June 11, 2022, 02:20:37 pm »

I've analyzed my music files with Mixed In Key 10 and imported the Tempo, Camelot Key and Energy values into User fields. I'd like to enter a Search Language sort statement, if it's possible, to sort the Camelo Key field in the following order:

1A,1B,2B,2A,3A,3B,4B,4A,5A,5B,6B,6A,7A,7B,8B,8A,9A,9B,10B,10A,11A,11B,12B,12A

These are the only values expected in this field.

If I do a simple ascending sort it's gets close but not exactly according to Harmonic mixing with the Camelot Wheel.

Any ideas on how to specify a particular sort order?
Logged

vbphil

  • World Citizen
  • ***
  • Posts: 133
Re: Search Language Special Sort Sequence
« Reply #1 on: June 13, 2022, 01:54:48 pm »

Create a new expression library field named something like _CamelotSort and use this as the expression;

regex(1=1A;2=1B;3=2B;4=2A;5=3A;6=3B;7=4B;8=4A;9=5A;10=5B;11=6B;12=6A;13=7A;14=7B;15=8B;16=8A;17=9A;18=9B;19=10B;20=10A;21=11A;22=11B;23=12B;24=12A;, /#(\d+)=(#/[Camelot_Key]/#)#/, 1)

In the expression, Camelot_key is the user field used to hold the Camelot key value. The new expression field, _CamelotSort can now be used for sorting playlists or whatever you got.

Thank you MrC.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2376
Re: Search Language Special Sort Sequence
« Reply #2 on: June 14, 2022, 10:28:28 am »

Or with listfind():
Code: [Select]
listfind(1A;1B;2B;2A;3A;3B;4B;4A;5A;5B;6B;6A;7A;7B;8B;8A;9A;9B;10B;10A;11A;11B;12B;12A,[Camelot_Key],-1,1,1)

It's possible that this still sorts wrong, because 10<2 in alphabetic sort. So maybe you need to add a left zero:
Code: [Select]
padnumber(listfind(1A;1B;2B;2A;3A;3B;4B;4A;5A;5B;6B;6A;7A;7B;8B;8A;9A;9B;10B;10A;11A;11B;12B;12A,[Camelot_Key],-1,1,1),2)
Logged

vbphil

  • World Citizen
  • ***
  • Posts: 133
Re: Search Language Special Sort Sequence
« Reply #3 on: June 14, 2022, 11:57:34 am »

It sorts correctly as integers so no zero required.
Logged
Pages: [1]   Go Up