You are viewing limited content. For full access, please sign in.

Question

Question

Field rule for children under the age of 18

asked on May 17, 2021

I'd like to create a rule in my form that states "if the date of birth is under age 18 as of today, then show the trustee field. If it is over age 18 as of today, then hide and ignore the trustee field".

I can find a rule that ALMOST gives me what I need, but it doesn't allow me to say "as of today", it only allows me to pick a specific date.

Any suggestions?

DOB.PNG
DOB.PNG (23.15 KB)
0 0

Answer

SELECTED ANSWER
replied on May 19, 2021

It's probably because your Age field is outside of the table but your date field is inside the table. What happens if another row is added? It doesn't know which field to use. 

I would suggest putting Age as a table column so if they add another column, it calculates the age for each person. 

=(YEAR(NOW())-YEAR(INDEX(Beneficiary_Designation.DOB,ROW())))

So you'd take the value of the DOB column at the given row and subtract the current year from that year. 

0 0

Replies

replied on May 17, 2021

You'll want to do the "Is 18?" calculation in a hidden field. I would create a hidden field called 

AGE and set it with a formula from this site: https://support.microsoft.com/en-us/office/calculate-age-113d599f-5fea-448f-a4c3-268927911b37 something like =(YEAR(NOW())-YEAR(A2))

Then have another hidden field for Is_18 and your formula is =IF(AGE>18,"TRUE","FALSE"). 

Your field rule can then be, If Is_18 is True...

 

3 0
replied on May 19, 2021

For some reason, I am now getting an error message in the Age of Beneficiary field when I fill out the form.

Am I doing something wrong? 

0 0
SELECTED ANSWER
replied on May 19, 2021

It's probably because your Age field is outside of the table but your date field is inside the table. What happens if another row is added? It doesn't know which field to use. 

I would suggest putting Age as a table column so if they add another column, it calculates the age for each person. 

=(YEAR(NOW())-YEAR(INDEX(Beneficiary_Designation.DOB,ROW())))

So you'd take the value of the DOB column at the given row and subtract the current year from that year. 

0 0
replied on May 19, 2021

Perfection, that was it. Thank you!

0 0
replied on May 17, 2021

This worked perfectly, thank you!!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.