# How to display (composer) if one exists and blank otherwise

**URL:** https://community.mp3tag.de/t/how-to-display-composer-if-one-exists-and-blank-otherwise/71703
**Category:** Support
**Created:** [August 5, 2026, 5:02pm UTC](https://community.mp3tag.de/t/how-to-display-composer-if-one-exists-and-blank-otherwise/71703 "2026-08-05T17:02:56Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![LeoL](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/db5fbb/32.png) [@LeoL](https://community.mp3tag.de/u/LeoL)
#### Post date: [August 5, 2026, 5:02pm UTC](https://community.mp3tag.de/t/how-to-display-composer-if-one-exists-and-blank-otherwise/71703/1 "2026-08-05T17:02:56Z")

</div>

I'm trying to use tag to file name where I want (composer) if one exists and blank otherwise but I can't seem to find the correct syntax. Can someone please tell me where to find this?

I thought it would be something like $if(%composer%) but that doesn't work.

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [August 5, 2026, 5:06pm UTC](https://community.mp3tag.de/t/how-to-display-composer-if-one-exists-and-blank-otherwise/71703/2 "2026-08-05T17:06:03Z")

</div>

Try for the composer part:  
`[%composer%]`  
or even  
`[- %composer%]`

See also the documenation on Format strings:

> **[Characters with Special Functionality - Format Strings and Placeholders – Mp3tag...](https://docs.mp3tag.de/format/#characters-with-special-functionality)**
>
> Mp3tag uses format strings in various of its features to describe the structure of file names and imported data. A format string is built of either standard text (e.g., Music), placeholders (such as %artist%, %title%, …), or backslash characters \\...

---

<div class="post-metadata">

### Author: ![mctaggerty](https://community.mp3tag.de/user_avatar/community.mp3tag.de/mctaggerty/32/23377_2.png) [@mctaggerty](https://community.mp3tag.de/u/mctaggerty)
#### Post date: [August 5, 2026, 11:27pm UTC](https://community.mp3tag.de/t/how-to-display-composer-if-one-exists-and-blank-otherwise/71703/3 "2026-08-05T23:27:46Z")

</div>

> [@LeoL](#):
>
> I'm trying to use tag to file name where I want (composer) if one exists and blank otherwise but I can't seem to find the correct syntax.

> [@LeoL](#):
>
> I thought it would be something like $if(%composer%) but that doesn't work.

Naturally, I'm not certain of your particular approach, but I would use something like:

```auto
$if(%composer%,%composer%,)

```

A quick explanation of what this does:

If the COMPOSER field is populated, the value of COMPOSER is exported to the filename; if it isn't populated, no value is exported.

Consider it like an `if, then, else` type of construct (separated by the commas).

This is how it might be used in context:

```auto
$num(%track%,2). %artist% - %title%$if(%composer%,' - '%composer%,)

```

And the resulting filename would be something like:

```auto
01. Meco - Star Wars Theme - Meco Monardo.mp3

```

Notice the `' - '%composer%` in the above string?

The `' - '` was added in that position so that the extraneous _dash_ only appears in the case that COMPOSER is populated.

I trust this is in some way helpful.

Regards.

---

<div class="post-metadata">

### Author: ![MotleyG](https://community.mp3tag.de/user_avatar/community.mp3tag.de/motleyg/32/440_2.png) [@MotleyG](https://community.mp3tag.de/u/MotleyG)
#### Post date: [August 6, 2026, 12:57am UTC](https://community.mp3tag.de/t/how-to-display-composer-if-one-exists-and-blank-otherwise/71703/4 "2026-08-06T00:57:57Z")

</div>

I highly recommend the solution in post #2 by @ohrenkino as it uses the standard approach built into mp3tag. Any field enclosed within square brackets is only operated if the field exists. No additional if statements or testing is required in this case.

> [@ohrenkino](#):
>
> Try for the composer part:  
> `[%composer%]`

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [August 6, 2026, 5:29am UTC](https://community.mp3tag.de/t/how-to-display-composer-if-one-exists-and-blank-otherwise/71703/5 "2026-08-06T05:29:37Z")

</div>

> [@MotleyG](#):
>
> I highly recommend the solution in post #2 by @ohrenkino

Exactly. No need for `$if`, just use

`$num(%track%,2). %artist% - %title%[- %composer%]`  
which results in  
`05. ABBA - My Mama said - Benny Andersson.mp3`  
or if no `COMPOSER` content exists:  
`05. ABBA - My Mama said.mp3`

As the already linked documentation says about `[...]`

> `[...]` The contents of brackets are displayed only if at least one of the placeholders used inside the brackets has been found.

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [August 6, 2026, 6:00am UTC](https://community.mp3tag.de/t/how-to-display-composer-if-one-exists-and-blank-otherwise/71703/6 "2026-08-06T06:00:00Z")

</div>

> [@mctaggerty](#):
>
> The `' - '` was added in that position so that the extraneous _dash_ only appears in the case that COMPOSER is populated.

That is not entirely accurate.  
The entire THEN part `' - '%composer%` in your `$if` formula will only be used if the checked `COMPOSER` field is not empty.  
Just a quick note: apostrophes/single quotation marks aren't really necessary in this case.  
`$if(%composer%, - %composer%,)` works too.

---

<div class="post-metadata">

### Author: ![mctaggerty](https://community.mp3tag.de/user_avatar/community.mp3tag.de/mctaggerty/32/23377_2.png) [@mctaggerty](https://community.mp3tag.de/u/mctaggerty)
#### Post date: [August 6, 2026, 7:56am UTC](https://community.mp3tag.de/t/how-to-display-composer-if-one-exists-and-blank-otherwise/71703/7 "2026-08-06T07:56:27Z")

</div>

> [@LyricsLover](#):
>
> > [@mctaggerty](#):
> >
> > The `' - '` was added in that position so that the extraneous _dash_ only appears in the case that COMPOSER is populated.
> 
> That is not entirely accurate.

That was entirely accurate.

> [@LyricsLover](#):
>
> The entire THEN part `' - '%composer%` in your `$if` formula will only be used if the checked `COMPOSER` field is not empty.

The "THEN" portion will be used if the COMPOSER field is populated (is not empty) and returns data, just as I said.

You only wrote it differently. 😉

However, using `[- %composer%]` in that fashion is certainly cleaner, as you say.

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [August 6, 2026, 8:24am UTC](https://community.mp3tag.de/t/how-to-display-composer-if-one-exists-and-blank-otherwise/71703/8 "2026-08-06T08:24:56Z")

</div>

You are right, I should have phrased it differently.

"Not empty" was a bit too casual here and blurred the actual distinction. The condition is not really "not empty" versus "empty" - it is whether the field exists or not.

An empty `COMPOSER` field is not possible in this context: the field either exists and has a value, or it does not exist at all. So the relevant point is the presence of the field, not whether it is empty.

Both variants - your `$if(x,y,z)` syntax and the usual `[x]` check - evaluate whether field `X` exists.

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [August 9, 2026, 7:22am UTC](https://community.mp3tag.de/t/how-to-display-composer-if-one-exists-and-blank-otherwise/71703/9 "2026-08-09T07:22:06Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
