# Removing the - - when field is empty

**URL:** <https://community.mp3tag.de/t/removing-the-when-field-is-empty/51773>\
**Category:** Support\
**Created:** [January 29, 2021, 9:53am UTC](https://community.mp3tag.de/t/removing-the-when-field-is-empty/51773 "2021-01-29T09:53:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrickbarbary](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/6bbea6/32.png) [@patrickbarbary](https://community.mp3tag.de/u/patrickbarbary)\
**Post date:** [January 29, 2021, 9:53am UTC](https://community.mp3tag.de/t/removing-the-when-field-is-empty/51773/1 "2021-01-29T09:53:40Z")

</div>

I wish I could code but I can't. When using this script:"%artist% - %title% - %album% - $num(%track%,2)" Is their a way to avoid the - - when there is no album field (or an empty field). And secondly, is there a way to pick the albumartist (with priority to artist) if there is no artist field? Thanks a million.

---

<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:** [January 29, 2021, 10:15am UTC](https://community.mp3tag.de/t/removing-the-when-field-is-empty/51773/2 "2021-01-29T10:15:24Z")

</div>

> [@patrickbarbary](#):
>
> when there is no album field (or an empty field).

If you enclose a field variable in square brackets, everything inside the brackets will only be output if the field is filled.  
E.g  
%artist% - %title%[- %album%] - $num(%track%,2)

> [@patrickbarbary](#):
>
> pick the albumartist (with priority to artist) if there is no artist field?

I think that something like this could work:  
$if2(%artist%,%albumartist%)  
I would fill all the fields, though as non-existing information might lead to strange sorting results.

---

<div class="post-metadata">

**Author:** ![patrickbarbary](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/6bbea6/32.png) [@patrickbarbary](https://community.mp3tag.de/u/patrickbarbary)\
**Post date:** [January 29, 2021, 10:37am UTC](https://community.mp3tag.de/t/removing-the-when-field-is-empty/51773/3 "2021-01-29T10:37:00Z")

</div>

Thank you so much!!!

---

<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:** [February 9, 2026, 12:29pm UTC](https://community.mp3tag.de/t/removing-the-when-field-is-empty/51773/4 "2026-02-09T12:29:02Z")

</div>


