Sometimes my users know a person's birthdate,...

(Nicholas Christoffersen) #1

Sometimes my users know a person’s birthdate, and sometimes they only know their age, and sometimes they dont know either value and they will leave both fields blank.

I have a birthdate field, and an editable age field with an initial value based on the birthdate.

I am using the following formula for the initial value (slightly modified from another post here, thank you).

The data type of the age field is number.

If a user types in an age, I want to limit their input to integers only.

=if(isnotblank([Fecha Nacimiento]),

if(

month([Fecha Nacimiento])>month(today()), year(today())-year([Fecha Nacimiento])-1,

if(

and(

month([Fecha Nacimiento])=month(today()),

day([Fecha Nacimiento])>day(today())

),

year(today())-year([Fecha Nacimiento])-1, year(today())-year([Fecha Nacimiento])

)

),"" )

Note that I am using two double quotes to indicate that the field should be left blank if no birthdate is available to calculate a value.

However the field defaults to 0 instead of blank.

If I save the record without clearing the field, the 0 is saved.

What can I put instead of two double quotes to default the field to blank instead of zero?

(Levent KULAÇOĞLU) #2

@Nicholas_Christoffer Instead of double quotes, you can use Number("") which will leave integer field value blank

(Nicholas Christoffersen) #3

@Levent_KULACOGLU This worked great, thank you!