Author Topic: Issue with functions in track information panel  (Read 823 times)

Tybot

  • Sr. Member
  • ****
  • Posts: 336
I'm going to try to lay this out as clearly as possible but it is kind of a mess.

Basically, I'm trying to display two different tags in the track information panel depending on whether the album is a compilation or not. I use this to display the conductor on individual tracks while the album conductor (the default <conductor> tag) is set to "Multiple", and it works perfectly.

Code
$If($Contains(<Conductor>,Multiple)="T",$Split(<Classical_Misc>,_,16),$Replace(<Conductor>,;," &"))



The <Classical_Misc> tag is a custom tag with a lot of different values that are then split with virtual tags. However, I started running out of those so I thought that I could, simply for appearances sake, split the custom tag directly in the track information panel. The issue I encountered is when I was trying to display the main performer in the same manner as described above. Since the main performer could be either and orchestra or a soloist I wanted to return the first non-empty field of those two using the $IsNull function. I believe it's a nesting error on my part but I really can't be sure. Here's what I've come up with and this doesn't work:

Code
$If($Contains(<[PrimaryPerformer]>,Multiple)="T",$IsNull($Split(<Classical_Misc>,_,18),$Split(<Classical_Misc>,_,20),$Split(<Classical_Misc>,_,18),<[PrimaryPerformer>))


For those of you who understands this inside and out it's probably pretty clear what I'm trying to accomplish but I'll break it down further anyway.

(<Classical_Misc>,_,18) contains the orchestra if there is one and (<Classical_Misc>,_,20) contains the soloist. If the tag <[PrimaryPerformer]> is set to "Multiple" I want to check <Classical_Misc,_,18> to see if there's and orchestra and if so, display that value. If there isn't, I want it to check <Classical_Misc,_,18> and display the soloist instead. If both are empty then I suppose nothing should be displayed and if <[PrimaryPerformer]> is not set to "Multiple" it should just display whatever else is in that tag.


Here's a screen. Red box displays the tag <Conductor> and <[PrimaryPerformer]>. Blue box is what I'm trying to fix and as you can see, with the conductor it does exactly what it should.

https://i.imgur.com/BPAdIIU.jpg
Last Edit: June 06, 2020, 10:58:44 PM by Tybot

hiccup

  • Sr. Member
  • ****
  • Posts: 7873
Yes, you need to nest the $IsNull's.
In your current formula it has four arguments while it should have two.

This should work (I think):

Code
$If($Contains(<[PrimaryPerformer]>,Multiple)="T",$IsNull($Split(<Classical_Misc>,_,18),$IsNull($Split(<Classical_Misc>,_,20),,$Split(<Classical_Misc>,_,20)),$Split(<Classical_Misc>,_,18)),<[PrimaryPerformer>)

Tybot

  • Sr. Member
  • ****
  • Posts: 336
Yes, you need to nest the $IsNull's.
In your current formula it has four arguments while it should have two.

This should work (I think):

Code
$If($Contains(<[PrimaryPerformer]>,Multiple)="T",$IsNull($Split(<Classical_Misc>,_,18),$IsNull($Split(<Classical_Misc>,_,20),,$Split(<Classical_Misc>,_,20)),$Split(<Classical_Misc>,_,18)),<[PrimaryPerformer>)


Your suggestion didn't work so I tried again with some different functions. They didn't work either... And that's when I noticed that the brackets I use to note my virtual tags were missing from the last <[PrimaryPerformer]>, and now I feel really stupid. When adding the missing bracket, what you provided works perfectly and so did my second attempt:

Code
$If(<[PrimaryPerformer]>=Multiple,$IsNull($Split(<classical_misc>,_,18),$Split(<classical_misc>,_,20),$Split(<classical_misc>,_,18)),$Replace(<[PrimaryPerformer]>,;," &"))

Apologies for wasting your time.