Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: How to remove the last comma at the end of this Post Reply Post New Topic
Author Message
pectin232
Newbie
Newbie


Joined: 12 Jan 2011
Location: United States
Online Status: Offline
Posts: 5
Quote pectin232 Replybullet Topic: How to remove the last comma at the end of this
     Posted: 21 Jan 2011 at 9:20am
In the code below... there is always a comma at the end of it... I am not sure how to suppress the last comma... it would say: emails, no contact, supervised, letter, phone call, unsupervised visits,

Although it might not show all but it tends to show a comma at the end. Advise? Thanks


TRIMLEFT({@Visit Type - Email}+' '+{@Visit Type - No Contact}+' '+{@Visit Type - Supervised}+' '+{@Visit Type - Letter}+' '+{@Visit Type - Phone Call}+' '+{@Visit Type - Unsupervised Visits})
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 21 Jan 2011 at 10:05am
Do the values in those fields have commas at the end?
IP IP Logged
pectin232
Newbie
Newbie


Joined: 12 Jan 2011
Location: United States
Online Status: Offline
Posts: 5
Quote pectin232 Replybullet Posted: 22 Jan 2011 at 3:04am
Originally posted by Keikoku

Do the values in those fields have commas at the end?


Yes they are like this

emails, no contact, supervised, letter, phone call,

The problem is I only like to remove the last comma which is after the phone call.... there can be more after phone call, like unsupervised visits as well or even be just 2 like emails[comma] and supervised[comma]. This is on a text box field from the database from sql.


TRIMLEFT({@Visit Type - Email}+' '+{@Visit Type - No Contact}+' '+{@Visit Type - Supervised}+' '+{@Visit Type - Letter}+' '+{@Visit Type - Phone Call}+' '+{@Visit Type - Unsupervised Visits})
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 24 Jan 2011 at 2:53am
I am not sure of any elegant methods to do so, but you can write something like

 {@Visit Type - Unsupervised Visits})[1 to length({@Visit Type - Unsupervised Visits}) - 1)]


This will show all of the characters before the last one (which I assume is the comma), so you effectively ignore the comma.
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