Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Remove number Post Reply Post New Topic
Author Message
immad
Newbie
Newbie


Joined: 05 Jun 2013
Location: Pakistan
Online Status: Offline
Posts: 25
Quote immad Replybullet Topic: Remove number
     Posted: 07 Apr 2015 at 11:43pm

Hi,
my data is like this

SalesPerson
aw.ab998
11abb.ia
aa
111a

i want data looks like this

SalesPerson
awab
abbia
aa
a

i want a Formula that remove numbers and (.)

please help me out
thanks for the help
immad
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 08 Apr 2015 at 4:50am
Removing the period is easy replace({somefield},".","").  Can't think of an easy way to get rid of the numbers.  A for loop to look at each character and see if it is numeric, if so.  Remove the number out of the string.
IP IP Logged
immad
Newbie
Newbie


Joined: 05 Jun 2013
Location: Pakistan
Online Status: Offline
Posts: 25
Quote immad Replybullet Posted: 08 Apr 2015 at 7:47pm
hi,
please can you provide me syntax
thanks for the help
immad
IP IP Logged
paulhoving
Newbie
Newbie


Joined: 21 Nov 2014
Online Status: Offline
Posts: 7
Quote paulhoving Replybullet Posted: 09 Apr 2015 at 4:07am
There are two solutions. I am not sure what the results will be in memoryusage / performance.

1. A nested replace

replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace({somefield},".",""),"0",""),"1",""),"2",""),"3",""),"4",""),"5",""),"6",""),"7",""),"8",""),"9","")


2. use a function:

Function (stringvar inString)
(
    Local Stringvar outString := "";
    Local Numbervar i;
    For i :=1 To Length(inString) Do
    (
        If inStr("0123456789.", inString) =0 Then
        (
            outString := outString + inString;
        )
    );
outString
)

IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum