Link to home
Create AccountLog in
Avatar of nobile00
nobile00

asked on

Crystal Formula to Remove Decimal Places

Hi

I have the following formula to do an age calculation however when the age displays it displays example: 18.00 I would like it to display like 18 I added what I thought would work and now getting an error too many arguments

The formula:

iF CURRENTDATE-{patient_current_demographics.date_of_birth} <365 THEN "Under 1 yr" else
totext(TRUNCATE ((if datepart('y',currentdate)<datepart('y',{patient_current_demographics.date_of_birth}) then datediff('yyyy',{patient_current_demographics.date_of_birth},currentdate)-1 else datediff('yyyy',{patient_current_demographics.date_of_birth},currentdate,0,''))))

What can I do to correct the issue?

Thanks so much
Avatar of Mike McCracken
Mike McCracken

Try

iF CURRENTDATE-{patient_current_demographics.date_of_birth} <365 THEN "Under 1 yr" else
totext(TRUNCATE ((if datepart('y',currentdate)<datepart('y',{patient_current_demographics.date_of_birth}) then datediff('yyyy',{patient_current_demographics.date_of_birth},currentdate)-1 else datediff('yyyy',{patient_current_demographics.date_of_birth},currentdate,0,''))),0,"")

mlmcc
Avatar of nobile00

ASKER

I have tried the formula and is returning the same error too many arguments given to this function and pointing to
,{patient_current_demographics.date_of_birth},currentdate,0,''))),0,"")

Thanks for your help
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Thanks so much for your help it is now working.