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