Using IF statement to determine value based on another field

I have a field where I calculate the age of the person based off their birthdate. I have another field where I am giving a random money value, called salary. If the age is less than 21, I want the salary field to be empty, otherwise pick a radon value based on my conditions I have set for the ‘Money’ data type.

Field Name: salary
Type: Money
Between: 35000 and 200000

FX: if field(‘age’) < 21 then field(‘age’) = NULL

I am getting the following:
Syntax error in formula ‘if field(‘age’) < 21 then field(‘age’) = NULL’

Any ideas how to get past this?

I managed to solve it. I used:
if age < 19 then 0 elsif age > 19 then random(35000, 250000) end

2 Likes