More > JRiver Media Center 32 for Mac
Expression for cases
Vadomar:
Thank you both for your answers and good solutions, all work! I am trying to understand now this one:
--- Code: ---listbuild(1,/:/ ,listbuild(1,/,/ ,[soloist], [conductor]), [orchestra])
--- End code ---
I do have after soloist always a comma. With this, if there is no conductor, it will show a ":". Can this be implemented in this formula or is it better to go with the first long one zybex mentioned?
Thanks again in advance!
EnglishTiger:
@zybex and lepa :-
As a rule for creating [artistcalculated] lepa's NA solution is OK if it is only used for tracks that normally have a combination of Soloist, Orchestra and Conductor - but "NA, Herbert von Karajan: Berlin Philharmonic Orchestra" is going to look very wrong for most of the movements from Ludwig Van Beethoven's Symphonies.
zybex:
--- Quote from: Vadomar on February 19, 2024, 05:45:58 am ---Thank you both for your answers and good solutions, all work! I am trying to understand now this one:
--- Code: ---listbuild(1,/:/ ,listbuild(1,/,/ ,[soloist], [conductor]), [orchestra])
--- End code ---
I do have after soloist always a comma. With this, if there is no conductor, it will show a ":". Can this be implemented in this formula or is it better to go with the first long one zybex mentioned?
Thanks again in advance!
--- End quote ---
Why not try it? It does exactly what you requested :)
The comma in "[soloist], [conductor]" is a function separator, not a literal comma. This "/," is a literal comma in an expression.
ListBuild(1,/,/ ,[soloist], [conductor]) - builds a list (joins) of those 2 items using ", " as a separator ("/,/ "). Mode 1 means that empty items will not be in the list, so if there's only one value there's no separator. If both values are missing then the function returns an empty string.
The second ListBuild (first in the expression) then does the same between this result and the [orchestra], but using ": " as the separator.
lepa:
If you want to have those placeholder (NA = Not Available/Applicable etc) then use my first one with FirstNotEmpty
If you wan to show only what exist then use zybex's last one. ": " is not shown if there is only orchestra available as there is then only on item so delimiter ": " is not needed and thus not inserted
Vadomar:
Thanks, this is great help! I now brought it down to this for two different interpunctuations (after soloist there is always a "•", never a ":"):
--- Code: ---IfElse(
[conductor],
listbuild(1,/:/ ,
listbuild(1,/ •/ ,[soloist],[conductor]),
[orchestra]),
isempty([conductor]),
listbuild(1,/ •/ /
,listbuild(1,/ •/ ,[soloist],[conductor]),
[orchestra]/
)
)
--- End code ---
Now help me understand also as an example for some other fields I have, how do I add more conditions? Because I have also a custom field [choir]. So now what if the following fields are given but no soloist:
[conductor] = Herbert von Karajan
[orchestra] = Berlin Philharmonic
[choir] = Thomanerchor Leipzig
The [choir] should be added after the [orchestra] separated by a comma, like this:
Herbert von Karajan: Berlin Philharmonic, Thomanerchoir Leipzig
Or different case, let’s say, there is a cappella with only a soloist and a choir but no conductor or orchestra:
[soloist] = Kurt Moll
[choir] = Leipziger Gewandhauschor
How do I get this to work properly to look like – is it still right with using ifelse or is there an easier solution? It should then look like:
Kurt Moll • Leipziger Gewandhauschor
You don’t need to decline it through for me, it only would be helpful to give me an idea of the correct syntax.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version