Good morning.
I was asked to print the number of years and months that a client has been residing in some state, for this I must add the words "years" and "months" or "year" and "month" depending on the case.
It's the first time I use Crystal Reports, so I'm not sure if I did this well, I wrote the following code and it gives me an error that says "the string is not numeric", I appreciate your help.
if((tonumber({CRE050.ANIOS_RESIDENCIA})>1) and (tonumber({CRE050.MESES_RESIDENCIA})>1))
then({CRE050.ANIOS_RESIDENCIA} & "Años" & {CRE050.MESES_RESIDENCIA} & "Meses";)
else
if((tonumber({CRE050.ANIOS_RESIDENCIA})>1)and (tonumber({CRE050.MESES_RESIDENCIA})=1))
then ({CRE050.ANIOS_RESIDENCIA} & "Años" & {CRE050.MESES_RESIDENCIA} & "Mes";)
else
if((tonumber({CRE050.ANIOS_RESIDENCIA})=1)and(tonumber({CRE050.MESES_RESIDENCIA})>1))
then({CRE050.ANIOS_RESIDENCIA} & "Año" & {CRE050.MESES_RESIDENCIA} & "Meses";)
else
if((tonumber({CRE050.ANIOS_RESIDENCIA})=1)and(tonumber({CRE050.MESES_RESIDENCIA})=1))
then({CRE050.ANIOS_RESIDENCIA} & "Año" & {CRE050.MESES_RESIDENCIA} & "Meses";)
else
if((tonumber({CRE050.ANIOS_RESIDENCIA})=0)and(tonumber({CRE050.MESES_RESIDENCIA})=1))
then({CRE050.MESES_RESIDENCIA} & "Mes";)
else
if((tonumber({CRE050.ANIOS_RESIDENCIA})=0)and(tonumber({CRE050.MESES_RESIDENCIA})>1))
then({CRE050.MESES_RESIDENCIA} & "Meses";)
else
if((tonumber({CRE050.ANIOS_RESIDENCIA})=1)and(tonumber({CRE050.MESES_RESIDENCIA})=0))
then({CRE050.ANIOS_RESIDENCIA} & "Año";)
else
if((tonumber({CRE050.ANIOS_RESIDENCIA})>1)and(tonumber({CRE050.MESES_RESIDENCIA})=0))
then({CRE050.ANIOS_RESIDENCIA} & "Años";)