Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing Punctuation 1

Status
Not open for further replies.

karengarrette

Technical User
Jun 27, 2002
23
0
0
GB
Hi

I have a report which takes information from a customer database and arranges it, so that it can be used by a carrier to produce despatch information. The interface that they use does not deal with punctuation, but it is possible that the data might contain punctuation.

I want to strip the puncuation out of the crystal report, there are about 20 fields in the report and about half of the could potentially have punctuation.

Any ideas would be gratefully recieved.

Cheers

Karen
 
You would have to write a formula for each field, using the REPLACE for each character you want to remove (nest them).
If these fields are MEMO or over 255 characters, you won't be able to use replace. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
thanks Ken

Too many variables in my report to use this, as I am doing tests on the data, to include or not include in certain circumstances already, and the different possibilities in terms of punctuation make it impossible to use replace.

Thanks Anyway
 
You might consider using VB or another language to create a remove punctuation UFL that can be used in Crystal. Software Sales, Training and Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
Karen,

I don't know what version of Crystal you're on. If I assume that you're on Crystal 8 or later, then I don't see why something like the following shouldn't get you home and dry.

//@PunctuationStripper
Code:
WhilePrintingRecords;
StringVar MyField;
StringVar Strip;
StringVar Alphabet;

MyField := {YourDatabaseField};
Alphabet:= "abcdefghijklmnopqrstuvwxyz"; 

While Length(MyField) > 0 
Do
    (
        If IsNumeric(Left(MyField,1)) 
        Then Strip := Strip + Left(MyField,1)
        Else
            If LowerCase(Left(MyField,1)) in Alphabet
            Then Strip := Strip + Left(MyField,1);
        MyField:= Mid(MyField,2);
    );
    
StripMe;
Good luck with your report,

Naith
 
I meant to end the formula with "Strip", not "StripMe".

There's probably something Freudian about that error, but I don't want to go into it.

Naith
 
Naith,

You started off my week with a good laugh. Good suggestion too. Software Sales, Training and Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
Always glad to be the butt of a joke, Dgillz, if you'll scuse the pun.

Karen, there should also be a space at the end of the Alphabet variable, so it's "...xyz ". This'll ensure that fields with spaces in them don't appearlikethis.

Sorry I didn't mention that earlier. I didn't test...

All the best,

Naith
 
Thanks everyone, used a combination of VB and Naith's suggestion to write a user defined function to do it.

 
Karen,

Would you be interested in sharing that UFL? Software Sales, Training and Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
Hi there,

dgillz - I've got the compiled UFL I wrote for Karen here in a little ZIP file, along with a little install script. I have e-mailed you a copy.

As for everyone else - is there anywhere I can upload it to so everyone can have access to it? Or anyone with a web-site that will take it?

Regards,

Paul.
 
I can post it. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top