Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Number Sorting for Tags with Word Strings (Read 3697 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Number Sorting for Tags with Word Strings

Hello Everyone

I have over 100 symphonies by Haydn and I don't want to type "Symphony No. xxx" for all the symphonies for it to sort properly. using the "$num(%work%,3)" custom sort for the field doesn't work because I have letters before the numbers.

Is there any way to get this to sort naturally?


I'm sure this must have been discuessed before, but I just couldn't find it. Sorry if this is a repeat.

- Andrew

Number Sorting for Tags with Word Strings

Reply #1
I dont actually know if this will work, but you might want to try this for a sort string:

$num($replace($lower(%work%),a,,b,,c,,d,,e,,f,,g,,h,,i,,j,,k,,l,,m,,n,,o,,p,,q,,r,,s,,t,,u,,v,,w,,x,,y,,z,),3)

Number Sorting for Tags with Word Strings

Reply #2
I dont actually know if this will work, but you might want to try this for a sort string:

$num($replace($lower(%work%),a,,b,,c,,d,,e,,f,,g,,h,,i,,j,,k,,l,,m,,n,,o,,p,,q,,r,,s,,t,,u,,v,,w,,x,,y,,z,),3)

hey thank a lot. that worked perfectly. I only added to the list a '.', because I have them ordered as Sumphony No. 3 <-- note the period.

The final working sort script is: $num($replace($lower(%work%),a,,b,,c,,d,,e,,f,,g,,h,,i,,j,,k,,l,,m,,n,,o,,p,,q,,r,,s,,t,,u,,v,,w,,x,,y,,z,'.',),3)


Thanks a lot buddy! That was a quick solution[/s]

Nevermind it doesn't work at all. I have no idea what I was thinking - I must be very tired.

Number Sorting for Tags with Word Strings

Reply #3
Maybe you need to add another entry to the list for the space?

Code: [Select]
$num($replace($lower(%work%),a,,b,,c,,d,,e,,f,,g,,h,,i,,j,,k,,l,,m,,n,,o,,p,,q,,r,,s,,t,,u,,v,,w,,x,,y,,z,,'.',, ,),3)

Can you give an example of what you put in your %work% tag?

Number Sorting for Tags with Word Strings

Reply #4
I dont actually know if this will work, but you might want to try this for a sort string:

$num($replace($lower(%work%),a,,b,,c,,d,,e,,f,,g,,h,,i,,j,,k,,l,,m,,n,,o,,p,,q,,r,,s,,t,,u,,v,,w,,x,,y,,z,),3)

hey thank a lot. that worked perfectly. I only added to the list a '.', because I have them ordered as Sumphony No. 3 <-- note the period.

The final working sort script is: $num($replace($lower(%work%),a,,b,,c,,d,,e,,f,,g,,h,,i,,j,,k,,l,,m,,n,,o,,p,,q,,r,,s,,t,,u,,v,,w,,x,,y,,z,'.',),3)


Thanks a lot buddy! That was a quick solution[/s]

Nevermind it doesn't work at all. I have no idea what I was thinking - I must be very tired.

There are 2 problems with the method you stated:

#(1) The following items don't sort properly:

Symphony No.1
Waltz No.1
Symphony No.2
Waltz No.2

I want the sort to still pay attention to alphabetization so it would be:

Symphony No.1
Symphony No.2
Waltz No.1
Waltz No.2


#(2) I don't want to type in the whole sort in every place I use it. Trying to do a custom sort of the composer column becomes unwieldy when I have it sorted by composer|album|tracknumber|title|,etc... with all of the fields having to change the number sorting.

Basically I want a change in foobar itself so it counts all numbers as xxx. That would make life much simpler. If anyone can figure out a way to solve this I would appreciate it VERY much (As in $10 via PayPal).

Thanks,

Andrew

Number Sorting for Tags with Word Strings

Reply #5
Code: [Select]
$substr(%work%,1,$strrchr(%work%,.)) $num($substr(%work%,$add($strrchr(%work%,.),1),$len(%work%)),3)

Sometimes I think we need a bigger box for the sort string.

Number Sorting for Tags with Word Strings

Reply #6
Can you give an example of what you put in your %work% tag?


Here are some examples and the order in which I'd like them sorted:

Piano Sonata No.11 in A Major
Piano Sonata No.12*
Piano Sonata No.13*
Sleeping Beauty Ballet
Sonata in c-sharp minor (Moonlight)
Swan Lake Ballet
Symphony No.98 in B-flat Major
Symphony No.103 in E-flat Major
Waltz No.11*
Waltz No.12*
Waltz No.13*

* Fake - just to demonstrate the prioritization of alphabetization before number sorting.


I think that covers all the characters I'll ever use in the field. I could always add more later, it's just that I'd have to change it in 6 seperate sorts manually.

I wish I could somehow make a global preset for Columns UI, for each field I want customized, to which I could refer the columns to sort. If this is possible, I'd appreciate any help on doing that.

Thanks again,

Andrew

Number Sorting for Tags with Word Strings

Reply #7
The simplest (not necessarily the best) way to do this from scratch (well, the simplest I can think of) would be to use three fields.

WORK=Piano Sonata
OPUS=11
KEY=A major

Then you can sort by %work% $num(%opus%,3) %key%.

Display code: %work% No. %opus% in %key%

Number Sorting for Tags with Word Strings

Reply #8
The simplest (not necessarily the best) way to do this from scratch (well, the simplest I can think of) would be to use three fields.

WORK=Piano Sonata
OPUS=11
KEY=A major

Then you can sort by %work% $num(%opus%,3) %key%.

Display code: %work% No. %opus% in %key%


Yea but that doesn't work very well for me given the way I organize the ballets (huge pain in the ass to organize btw!)


Number Sorting for Tags with Word Strings

Reply #10
I hope this is working for you:

Code: [Select]
$left(%work%,$put(x,$sub($strstr($replace(%work%,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,0,1),1),1)))$num($right(%work%,$sub($len(%work%),$get(x))),3)

Number Sorting for Tags with Word Strings

Reply #11
I hope this is working for you:

Code: [Select]
$left(%work%,$put(x,$sub($strstr($replace(%work%,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,0,1),1),1)))$num($right(%work%,$sub($len(%work%),$get(x))),3)

That did the trick Birk. Thanks a lot! The $10 via PayPal is yours if you want it. PM me

 
SimplePortal 1.0.0 RC1 © 2008-2021