How do I update an optional empty null field to BigQuery?

UPDATE abc.customer_profile
SET customer_profile.name = {{InputName.value}}, customer_profile.gender = {InputGender.value}}
WHERE customer_profile.email = {{InputEMail.value}}

This works when {{InputName.value}} and {InputGender.value}} are filled. But if the user leaves it blank it would show " Parameter type must be provided for null values." Error.

How can I update fields from a form with optional values (blank values)?

I tried this but it doesn't work.

UPDATE abc.customer_profile
SET customer_profile.name = {{InputName.value}}, customer_profile.gender = IFNULL({{InputGender.value}}, "XYZ")
WHERE customer_profile.email = {{InputEMail.value}}

hey @DATA_THATMEMORY ,

could you use a ternary to replace null with empty quotations?

{{InputGender.value == null ? '' : InputGender.value}}
3 Likes

I did not try that solution but thanks for the response!
I managed to work around the problem by setting all fields to empty quotations instead of null on the database level. So when I pull data from the database to update it's already an empty quotation to submit if no changes were added from the user.

Perhaps others looking into this error from the below thread can also benefit from this thread.

1 Like

glad you got it resolved @DATA_THATMEMORY !

1 Like