Unable to use logic operators ("Access denied to method")

I am using a function if col1 < '10' then nil else col1 end

When previewing/downloading data I am getting the message (in the data field with the function):

error: Access denied to method >.

Any ideas? (I receive the same error message with all logic operators involving greater than or less than symbols… interestingly the not equal (!=) and equal (==) are working.

Changing my references from the field name to field(“col1”) fixed this.

Hi,
I tried your solution . unfortunately its not working .Can you please let me know about it?

error: Access denied to method >.
formula: if field(“reason”) > ‘2000’ then ‘yesy’ else ‘no’ end

I’m guessing reason is something other than a number. You can cast it to a number using the to_i (integer) or to_f (float) methods.

For example:

if reason.to_i > 2000 then 'yes' else 'no' end

It worked . Thanks a lot for your help. Much appreciated