Custom list field not found in formula

Hi - What a great tool Mockaroo is, only just found it today.

Got a problem with a formula.

if field('SMETS Version') == 'S2' then ' ' end

The field is definitely there, I copied and pasted the name in. I wonder if it’s because it’s a Custom List? Would that be the cause?
Also how do you put a blank value in, instead of a space? Not a big problem but still…

Thanks for your help,
Pete

Is there an error message in the output, or is it just evaluating differently than expected?

For example, I’m using a custom list here and it seems to work fine:

Thanks for having a look. We’re doing slightly different things - maybe I’ve got the wrong end of the stick.

I have a field: Device Serial Number
Which is a RegEx of “MSNG\d{4,15}” then the fx button at the end has the formula in it. So if the row has “S2” in it, it should blank out this entry.

Ah, I’ve updated the example to use an inline formula. Here’s the formula I used:

if field('SMETS Version') == 'S1' then nil else this end

That returns a null for S1, you could also return a blank string with:

if field('SMETS Version') == 'S1' then '' else this end

The this keyword refers to the value of the current field.

Ah ha! In your example - when I switch the fields around, so Code is before SMETS Version, thats when you get the field not found error. Just reproduced it now. So it seems that fields are processed top-down?

Yes, it would be a bit complicated to figure which fields are dependent on eachother, so they are just evaluated in order from top to bottom. So any dependent fields must be below their dependencies.