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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove Non Printer characters

Status
Not open for further replies.

Cairmor

Technical User
Sep 14, 2007
5
US
I have a report column which appears blank when printing via Crystal reports 2008.

I ran a length({column}) on it and verified that length returns 1-15 blank characters on many records (the records appearing to be null)

I then ran length(trim({column})) on it, but the length did not change.

My data source is an old SAS system.

Any ideas on how to get rid of the records with non-printing characters?

Is there something like a clean() function in cr2008?
 
Have you turned off set Nulls to default.

File -> Report options uncheck box

Then in select expert set

not(isnull(yourfield))

Ian
 
There is no clean() function.

You can use the ASC function which returns the ASCII value of a single character.

So create a formula with the following expression:

ASC({table.field}[1])

in the selection formula make sure you only select those recrods with a value between 48 and 122.

ASCII 48 is 0 and 122 is z



Howard Hammerman,
Crystal Training and Crystal Material
On-site classes and one-on-one coaching
Low-cost telephone/email support
FREE independent Crystal newsletter
howard@hammerman.com
800-783-2269
 
Thanks for the replies..

.I used Howards recommendation with the asc function and got what I needed by looping thru each character of the field, checking for asc() being between 48 and 122, and reassembling the field value if the character was a valid one.

It worked out. Problem solved.
 
Good work! I should have suggested a loop.

Howard Hammerman,
Crystal Training and Crystal Material
On-site classes and one-on-one coaching
Low-cost telephone/email support
FREE independent Crystal newsletter
howard@hammerman.com
800-783-2269
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top