For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Crystal Reports > March 2006 > Covert String to Number









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Covert String to Number
jmawebco

2006-03-17, 7:00 pm

I have a data field that contains numbers as well as characters
(1,234.00 per year). I want to stirp all the non-numeric characters
from any field that has then so that I can present the numbers as
currency.

Does anyone know how I can do this and if so please give me an example
as I am very new at Crystal.

Thanks a bunch to everyone!

Jaime

Rob Diamant

2006-03-17, 7:00 pm

Create a formula field like this:
stringvar amt := ('1,027.00 per year');
numbervar pos := instr(amt, ' ');
ccur(left(amt,pos-1))

Rob
"jmawebco" <jaime.cruz@infrasourceinc.com> wrote in message
news:1142631013.306782.257910@i39g2000cwa.googlegroups.com...
>I have a data field that contains numbers as well as characters
> (1,234.00 per year). I want to stirp all the non-numeric characters
> from any field that has then so that I can present the numbers as
> currency.
>
> Does anyone know how I can do this and if so please give me an example
> as I am very new at Crystal.
>
> Thanks a bunch to everyone!
>
> Jaime
>



jmawebco

2006-03-21, 7:58 am

Thanks for your help. The only problem is that the field can contain
text in front and/or at the end of the numbers.

Rob Diamant

2006-03-21, 10:09 pm

Sounds like you will need write a loop to strip out the characters and then
convert the results.

"jmawebco" <jaime.cruz@infrasourceinc.com> wrote in message
news:1142946733.150476.90010@v46g2000cwv.googlegroups.com...
> Thanks for your help. The only problem is that the field can contain
> text in front and/or at the end of the numbers.
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com