Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Left of Semicolon Post Reply Post New Topic
Author Message
pbexpresss
Newbie
Newbie
Avatar

Joined: 14 Oct 2008
Online Status: Offline
Posts: 2
Quote pbexpresss Replybullet Topic: Left of Semicolon
     Posted: 14 Oct 2008 at 1:53pm
I'm fairly new to Crystal Reports and am in need of some help.  I have designed a payroll direct deposit stub for our accounting system.  Everything works great.  However, in my accounting system the employee's name is in this format:  Last; First I.  I need to reverse the order to First I. Last without the semicolon.  When creating a formula, how do I grab the entire last name and lose the semicolon?  (I.e. I can't use the typical Left() function because I don't know how long the last name is.)

Thanks for your help.
Dan Titus
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 14 Oct 2008 at 2:03pm
Hi Dan,
 
You can use the the InStr() function to find the location of the ";". Try something like this (it might be off by one character since I'm just typing this in without testing it).
NumberVar SemiColon;
StringVar NewName;
SemiColon := InStr({table.namefield}, ";");
NewName := Mid({table.namefield},SemiColon+1) & " " & Left({table.namefield}, SemiColon-1);
Since you're new to Crystal Reports, you might want to check out my Encyclopedia book. I have three chapters covering how to write formulas as well as sample code listings that demonstrate how to do everything. You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
pbexpresss
Newbie
Newbie
Avatar

Joined: 14 Oct 2008
Online Status: Offline
Posts: 2
Quote pbexpresss Replybullet Posted: 15 Oct 2008 at 9:36am
Thanks for the help.  That works great.

I will look at your book.  I definitely need a reference guide.

BTW I'm using Crystal with Timberline Software.  It's really great.
Dan Titus
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