Way back in 2010, marko helped me create an [Artist Letters] Calculated field, which I use when organizing my music files on disk, so that they go into folders like this:
M:\Audio\Music\0 - 9\2pac\The Don Killuminati - The 7 Day Theory (Makaveli)
M:\Audio\Music\A\Aphex Twin\I Care Because You Do [90-94]
M:\Audio\Music\A\The Avett Brothers\Four Thieves Gone - The Robbinsville Sessions
M:\Audio\Music\B\Benetar, Pat\Best Shots
M:\Audio\Music\B\The Beatles\Sgt. Pepper's Lonely Hearts Club Band
M:\Audio\Music\C\Chatham County Line\Speed of the Whippoorwill
M:\Audio\Music\D\Difranco, Ani\Dilate
M:\Audio\Music\E\Ellington, Duke\The Best of Duke Ellington
M:\Audio\Music\F\A Flock of Seagulls
M:\Audio\Music\F\The Felice Brothers\The Felice Brothers
<etc>You get the idea. It returns the first letter "folder name" that I want created for each given artist: 0-9, A, B, C, D, E, F, etc. But it does so in a smart way that it "ignores articles" such as: a, an, and the, making the results match the results of using MC with "ignore articles" enabled.
Here's my expression:
if(isequal(mid([artist],0,4),the/ ,1),mid([artist],4,1),if(isequal(mid([artist],0,3),an/ ,1),mid([artist],3,1),if(isequal(mid([artist],0,2),a/ ,1),mid([artist],2,1),if(isequal(Mid([artist],0,1),1,6),0 - 9,Mid([artist],0,1))))
It has been working since we made it back in 2010, but it is broken now. It returns: "Expression Error (Unknown)". I think I know why (the changes recently in the Expression Engine made it less forgiving of logic errors and/or the nesting changes), but I don't feel like diagnosing it because...
I'm sure there is a much better way to do this now, with RegEx instead of all the crazy If(isequal(mid)) statements.
Help?