Also, I notice that you are using has:field[...], which yields true if the field exists, even if the field value is empty. Depending on your particular use-case, if you can check for only non-blank field values, you can simplify the syntax by using the get[...] operator, like this:
if the list of input titles is empty then return a list consisting of a single constant string, otherwise return the original titles
So, if field-name-1 exists, else will return its content and the subsequent get filter will fail (or yield unexpected results if field-name-1 contains a tiddler title).
@TW_Tones: Good catch. Didn’t notice when copy-pasting that I forgot to add the closing bracket. But yeah, my comment was about @EricShulman’s else construction not being able to work as intended.
You are right. If field-name-1 has contents, then the above filter will attempt to get[field-name-2] using the contents of field-name-1 as an input title. What I should have written is: