I have used the following formula to change a string (DOB) to date format:
date(tonumber(left({person.date_of_birth},4)),tonumber(mid({person.date_of_birth},5,2)),tonumber(right({person.date_of_birth},2)))
After changing to a date format, I was then able to use the difference between the current date and DOB to compute Curr Age, which is a number format:
datediff('yyyy',{@DOB},currentdate)-(if datepart('y',currentdate)>datepart('y',{@DOB}) then 0 else 1)
PROBLEM:
I am trying to filter out all Curr Age>= 18, but I keep getting the following error:
The string is non-numeric and the formula editor highlights the (tonumber(left({person.date_of_birth},4)) part in the formula below, which is the same one above:
date(tonumber(left({person.date_of_birth},4)),tonumber(mid({person.date_of_birth},5,2)),tonumber(right({person.date_of_birth},2)))
Can someone please help and let me know what I need to change/add to fix this? Thank you so much.