# Preventing empty output lines in export

**URL:** <https://community.mp3tag.de/t/preventing-empty-output-lines-in-export/17746>\
**Category:** Support\
**Created:** [March 13, 2016, 9:27pm UTC](https://community.mp3tag.de/t/preventing-empty-output-lines-in-export/17746 "2016-03-13T21:27:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![just\_Addict](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/a9adbd/32.png) [@just\_Addict](https://community.mp3tag.de/u/just_Addict)\
**Post date:** [March 13, 2016, 9:27pm UTC](https://community.mp3tag.de/t/preventing-empty-output-lines-in-export/17746/1 "2016-03-13T21:27:45Z")

</div>

I've defined an mte export and read in the online help and also observed this in action that if you enclose a tag frame variable within right-angled brackets '[' and ']', it will not generate blank output if there is no value for the given tag frame variable.

However, I wanted to get some control over the 'no value' bit by using an $if formula to possibly check for an alternate source being present and fallback on a 'no value' in case the alternate contains the same value (e.g. Album Artist vs Track Artist, i.e. %albumartist% and %artist%

To my surprise the suppression of blank output then fails and outputs the line as if a value was present

used formula format (generalized for simplicity, which does exact same in practice) is

```
<previous export def line>[
  PERFORMER "$if(%albumartist%,%artist%,)"]

```

the below however does work and suppresses the line completely if no value is present.

```
<previous export def line>[
  PERFORMER "%artist%"]

```

I would however like to use the top example as this allows me the flexibility to not include that line if it is the same as the already exported %albumartist% line defined earlier in the export.  
The bottom version only allows me to either generate a lot of lines with redundant values or skip them when no value is present.

---

<div class="post-metadata">

**Author:** ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)\
**Post date:** [March 14, 2016, 8:12am UTC](https://community.mp3tag.de/t/preventing-empty-output-lines-in-export/17746/2 "2016-03-14T08:12:32Z")

</div>

> [@just\_Addict](#):
>
> I've defined an mte export and read in the online help and also observed this in action that if you enclose a tag frame variable within right-angled brackets '[' and ']', it will not generate blank output if there is no value for the given tag frame variable. ...  
> To my surprise the suppression of blank output then fails and outputs the line as if a value was present ...

Yes, in Mp3tag scripting language the [...] square bracket clamp is an operator.  
Once there is any tagfield content operator within the square bracket clamp, e. g. %TITLE%, which owns a value, then the entire content of the square bracket clamp will be come into usage.

This scripting line ...

**[PERFORMER "$if(%ALBUMARTIST%,%ARTIST%,)"]**

... or written as ...

**['PERFORMER "'$if(%ALBUMARTIST%,%ARTIST%,)'"']**

... has the meaning of ...  
"If ALBUMARTIST exists, then write ARTIST, else write nothing."

If ALBUMARTIST does not exist, but ARTIST exist, then the result is the text:

**'PERFORMER ""'**

Probably you want this expression ...

**['PERFORMER "'$if2(%ALBUMARTIST%,%ARTIST%)'"']**

... with the meaning of ...  
"If both tagfields do not exist, then the result is an empty string."

DD.20160314.1042.CET

---

<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:26pm UTC](https://community.mp3tag.de/t/preventing-empty-output-lines-in-export/17746/3 "2026-02-09T12:26:08Z")

</div>


