INTERACT FORUM
More => Old Versions => JRiver Media Center 30 for Windows => Topic started by: timwtheov on January 08, 2023, 11:17:21 am
-
I have a cacluclated field [Composer Name Swap] with this expression someone created for me to swap composer names when there's a third term (i.e., "Ludwig van Beethoven" becomes "Beethoven, Ludwig van") or something like Johann Strauss II, which becomes "Strauss, Johann II:"
if(!regex([Composer], /#^([^,]+)\s+([^,]*?)$#/),
[Composer],
regex(listclean([Composer], 2, / ),
/#^(?:(I+|[JS]r\.?)\s+)?([^ ]+)(.*)$#/, -1)[R2]/,/ listclean([R3], 2, / )[R1]
)
I also have a few composers with multiple names, e.g., "Al Piantadosi;Alfred Bryani;William Steffe" which show up like this:
"Steffe, Al Piantadosi, Alfred Bryani, William"
and some with just two names, such as "Paul Wright III;Lisa Shipman," which shows as "Shipman, Paul Wright III, Lisa"
Is it possible to modify the expression above to make these semicolon-delimited composers show as
"Piantadosi, Al, Alfred Bryan, William Steffe"
or
"Wright, Paul III, Lisa Shipman?"
Thanks for any all help!
-
https://yabb.jriver.com/interact/index.php/topic,133535.msg924988.html#msg924988
ListClean(
ListMix(
if(!Regex([L1], /#^([^,]+)\s+([^,]*?)$#/),
[L1],
Regex(ListClean([L1], 2, / ),/#^(?:(I+|[JS]r\.?)\s+)?([^ ]+)(.*)$#/, -1)[R2]/,/ ListClean([R3], 2, / )[R1]
)
,,[Composer]
)
,4
)&DataType=[List]
-
Swap() now supports lists - this produces the same output in almost all cases, but doesn't handle Jr./Sr. suffixes:
swap([composer])
-
Thanks Lepa and Zybex!
I knew I'd asked about something regarding this previously, but I'd forgotten what. Anyway, I think the improved
Swap([Composer])
will do me well for now. The original expression used to slow down my main composers view a lot anyway, and the one Lepa proposed was taking almost 20 seconds to load each time, which probably wouldn't work for my impatience tolerance.