INTERACT FORUM

Please login or register.

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

Author Topic: Expression to convert LP Side from number to a letter  (Read 1314 times)

Mike Foran

  • World Citizen
  • ***
  • Posts: 212
Expression to convert LP Side from number to a letter
« on: November 02, 2017, 04:42:41 pm »

I have added a library field to sort my music by LP side. Internally, I use an integer, because that's easier to compute. But for display, I want to convert that number to a letter, so it displays "Side A" instead of "Side 1." I'm currently using this mouthful of an expression to calculate the conversion:

Code: [Select]
ifelse(isequal([LP Side], 1), A, isequal([LP Side], 2), B, isequal([LP Side], 3), C, isequal([LP Side], 4), D, isequal([LP Side], 5), E, isequal([LP Side], 6), F, isequal([LP Side], 7), G, isequal([LP Side], 8), H, isequal([LP Side], 9), I, isequal([LP Side], 10), J, isequal([LP Side], 11), K, isequal([LP Side], 12), L, isequal([LP Side], 13), M, isequal([LP Side], 14), N,isequal([LP Side], 15), O, isequal([LP Side], 16), P)
It works, but a cumbersome solution. It would work much better if the expression were something that can more dynamically convert, but I don't know how to convert a number to a corresponding letter of the alphabet. None of my LPs or sets have more than 26 sides so I don't need any trap to convert beyond side 26. Can any expression gurus here suggest an way?
Logged

Mike Foran

  • World Citizen
  • ***
  • Posts: 212
Re: Expression to convert LP Side from number to a letter
« Reply #1 on: November 03, 2017, 09:14:20 am »

Just to follow up, this expression is a lot neater:

ListItem(;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, [LP Side])

Logged

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Expression to convert LP Side from number to a letter
« Reply #2 on: November 03, 2017, 09:41:26 am »

Good one - I've been away from computer so didn't post back but you found it yourself :)
Logged

Mike Foran

  • World Citizen
  • ***
  • Posts: 212
Re: Expression to convert LP Side from number to a letter
« Reply #3 on: November 06, 2017, 09:32:13 am »

I had some help.  :)
Logged
Pages: [1]   Go Up