Author Topic: Showing a tag (+text) only if somethings in the tagfield  (Read 9107 times)

Nikkel

  • Jr. Member
  • **
  • Posts: 38
I was actually typing a whole topic asking for help with showing tags only if they're available,
but as I was typing and still testing everything, I found out how I can do it.

If you want to show a (custom) tag only if it's available.
Say you have the tag-field set onto custom3:

<Artiest><IsNull(<Custom3>,, Feat. <Custom3>)>

This way if there's nothing in the tag-field, it shows nothing.
If there's an artists in the field (or anything else) It shows Feat. [ARTISTS]

I actually have no idea what the comma's are for, but it works, so who cares :-P
Hopefully some people think it's useful, as some people like to show the featured artists or disc-number, remix or whatever.

I was trying to find this out, because the old method i had asked for once in the forum in the past, didn't work any more:
<artist> <Custom3?null(:Feat. %)> - <title>



paq

  • Sr. Member
  • ****
  • Posts: 386
I actually have no idea what the comma's are for, but it works, so who cares :-P

The commas separate the parameters for the IsNull-function:
<IsNull(<Tag>,foo,bar)>

If <Tag> is null then foo is displayed, otherwise bar.

In your example nothing is shown when the tag is null because there is nothing between the first and second comma.

Nikkel

  • Jr. Member
  • **
  • Posts: 38
I see, now that you've told me, it's pretty simple actually  :D
So in my case there shouldn't be anything between the comma's because there's no featuring artist(s)  :)


lnminente

  • Sr. Member
  • ****
  • Posts: 1049
Tags (1)\Custom tags\Define new Tags\Virtual tags

I wrote these:
·Album: <Album Artist> - <Album> <IsNull(<Year>,,"("<Year>")")>
·Track: <IsNull(<Track#>,,<Track#>. )><If(<Artist>=<Album Artist>,,<Artist> - )> <Title>
·Track2: <Artist> - <Title>
·LastPlayed: <If(<Last Played>='Unknown',,Last played: <Last Played>)>

It has some basic functions like Left wich could help you for making short dates
Last Edit: April 17, 2012, 09:26:48 PM by lnminente

jistme

  • Guest
Thnx, will start experimenting with that also soon, but my question was more:

What did the OP mean by "help with showing tags only if they're available".
I wondered, showing them where exactly?

boroda

  • Sr. Member
  • ****
  • Posts: 4641
In virtual tag. But you can hide some static text if tag is empty also, i.e. you can display 'Album [Year]' in virtual tag if year is present and 'Album' (without brackets) if there is no year.

jistme

  • Guest
Thnx.
Funny how some things can be so confusing in the beginning, but once you understand, you can't imagine why it was so hard to grasp to begin with. (they should invent a pill for that)