Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Trimming field Post Reply Post New Topic
Author Message
Tori_Dee
Newbie
Newbie


Joined: 25 Jun 2018
Online Status: Offline
Posts: 6
Quote Tori_Dee Replybullet Topic: Trimming field
    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 "(###)"
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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

Edited by DBlank - 26 Sep 2018 at 11:03am
IP IP Logged
Tori_Dee
Newbie
Newbie


Joined: 25 Jun 2018
Online Status: Offline
Posts: 6
Quote Tori_Dee Replybullet 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.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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)
IP IP Logged
Tori_Dee
Newbie
Newbie


Joined: 25 Jun 2018
Online Status: Offline
Posts: 6
Quote Tori_Dee Replybullet Posted: 27 Sep 2018 at 4:43am
Thank you! That was perfect!
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.