Preventing empty output lines in export

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.

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 ...


... or written as ...


... 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:


Probably you want this expression ...


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