Make a column null based on another column

I am making a schema that includes addresses. I have the address separated into the columns ‘suburb_id’, ‘address’, and ‘postal_code’, The suburb_id has a random chance of being null. Is there a way to make address and postal code null only if suburb_id is null?

I.e. If the suburb_id is selected to be null, then address and postal code will also be null, but will be populated if suburb_id is not null.

You can do this by adding the following inline formula (The [Σ] button) to address and postal_code:

if suburb_id.nil?
  nil
else
  this
end

Just make sure that the suburb_id field comes before the other two.

1 Like

Thank you very much :slight_smile: