Usually, you can choose between two ways to format a field name in the Field Calculator:
If the field name has no spaces, you can use only the field name, like this:
If the field name has spaces or resembles a field calculator function, you must enclose the name in doublequotes, like this:
Your field, "left(dista" looks like the Field Calculator function
left(). It looks like the Field Calculator is attempting to run the
left() function instead of retrieving the field value.
That's actually not what I would expect from your function; since you put the field name in singlequotes, I would expect it to evaluate
'left(dista' as a string. It would find that the string
'layer' does not equal the string
'left(dista', so the result would always be
Try enclosing each field name in doublequotes, like this:
if("layer"="left(dista", 'match', 'unmatch')
If that doesn't work, it's probably because the Field Calculator gets confused by the parenthesis in the field name. In that case, re-name your fields so they don't have parentheses. Open the layer properties dialogue > source fields tab > Toggle editing mode on > re-type the field name.