Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: leftmost characters Post Reply Post New Topic
Author Message
macke
Newbie
Newbie


Joined: 19 Mar 2009
Location: United Kingdom
Online Status: Offline
Posts: 14
Quote macke Replybullet Topic: leftmost characters
     Posted: 06 Jul 2010 at 1:19am
I wish to display the leftmost characters in a string up to a particular character.

i.e. HT-236: LASER DISPLAY BOARD

or

20636789: APPLICATOR PLASTIC

I need to take all the characters up to the colon.

How can I do this?

macke
IP IP Logged
Emir_W
Senior Member
Senior Member
Avatar

Joined: 25 Apr 2010
Online Status: Offline
Posts: 228
Quote Emir_W Replybullet Posted: 06 Jul 2010 at 2:08am
try this:
left({tbl.field},instr({tbl.field},":")-1)
 
 
hope it help.
Emir W
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 06 Jul 2010 at 3:11am
Hi
 
You can also try using sql,  below is sample for specific col where you have :, you will need to select the cols you need for the report then create a view or stored procedure to extract the data for the report.
 
Select
CASE
CHARINDEX(':', Table.ColName) WHEN 0 THEN '' ELSE
left(Table.Colname, CHARINDEX(':', Table.colname)-1)
END
 
 
Cheers
Rahul
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