Print Page | Close Window

Trimming field

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22673
Printed Date: 04 May 2024 at 2:06am


Topic: Trimming field
Posted By: Tori_Dee
Subject: Trimming field
Date Posted: 26 Sep 2018 at 10:17am
Hi,

I have a field where at the end of each account is "(###)" however the # could change anywhere from 1 digit to 5 digits.
So you could have >100 different accounts with (###) but also >100 different accounts with (##)
ie. Jim Jones (1234), Sally Doe (12), Dottie Do (142), etc
we want: Jim Jones, Sally Doe, Dottie Do, etc

I can't figure out the best way to print the account name without the ending "(###)"



Replies:
Posted By: DBlank
Date Posted: 26 Sep 2018 at 11:02am
assuming no names have any of these characters 012345678() then you can do a replace for each of those with an empty string
...
I also am assuming that you actually have one field with a lot of comma separated names


Posted By: Tori_Dee
Date Posted: 26 Sep 2018 at 11:26am
Actually some names do have numbers in them.
The field is one name at a time. So it would only return Jim Jones (1234). But I was trying to show examples.


Posted By: DBlank
Date Posted: 27 Sep 2018 at 2:25am
if no names have ( in them then use a formula to find where that starts are return the left characters before that location
left(table.namefield,instr(table.namefield,'(')-1)


Posted By: Tori_Dee
Date Posted: 27 Sep 2018 at 4:43am
Thank you! That was perfect!



Print Page | Close Window