cancel
Showing results for 
Search instead for 
Did you mean: 

ToWords function for English and Spanish on the same report

Former Member
0 Kudos

I need to convert a number to English and to Spanish words to be displayed on the same report, side by side. ToWords function doesn't seem to accept an argument for the language. How do I accomplish this?

I am using Crystal Reports 2008. Thanks in advance for your help.

Regards,

Victor

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

No, I have not received an answer to this question. Any help is greatly appreciated.

Thanks,

Victor

Former Member
0 Kudos

This is by no means a great solution - having a language code parameter to ToWords would be a great solution - but you could create a function that translates from English to Spanish by more or less brute force. I would think the words returned by ToWords would be limited, so it wouldn't be particularly painful. Maybe something like (Basic Syntax):


function EN2SP (enString as string) as string

dim en() as string
dim sp() as string
dim i as number
dim xlate as string

en = Array("one", "two", "three", ... , "eleven", "twelve", ... "twenty", "thirty", ... )
sp = Array ("uno", "dos", ..., ..., ...)  ' Sorry, I don't know Spanish...

xlate = enString

for i = 1 to ubound(en)
  xlate = replace(xlate, en(i), sp(i))
next i

EN2SP = xlate

HTH,

Carl

Answers (1)

Answers (1)

Former Member
0 Kudos

I Victor, hope you solved your problem, I'm dealing with a similar situation, in my case, I need the function toWords to print in Spanish or English depending on a field value.

any help will be useful.

thanks.