Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Partial print Post Reply Post New Topic
Author Message
nalfein
Groupie
Groupie


Joined: 07 Jul 2008
Online Status: Offline
Posts: 47
Quote nalfein Replybullet Topic: Partial print
     Posted: 03 Sep 2009 at 7:42am
Hi all

I've a problem

I've a database field that can have this kind of value

bla bla bla a fixed word that can be John or Jamie bla bla bla

I've 2 field in the CR

I need that the 1st field print all until John or Jamie excluded and the 2nd print from John or Jamie (included) to the end

I've thought that the instr function will be great but I cannot achieve exactly how to do

Any idea?

Than you in advance for the answers [IMG]smileys/smiley1.gif" align="middle" />

Edited by nalfein - 03 Sep 2009 at 7:42am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 03 Sep 2009 at 8:49am
if instr(instr(table.blahblahfield," Jamie ")>) then
left(table.blahblahfield, instr(table.blahblahfield," Jamie "))
else
left(table.blahblahfield, instr(table.blahblahfield," John "))
 
 
if instr(instr(table.blahblahfield," Jamie ")>) then
mid(table.blahblahfield,instr(table.blahblahfield," Jamie "))
else
mid(table.blahblahfield,instr(table.blahblahfield," John "))
IP IP Logged
nalfein
Groupie
Groupie


Joined: 07 Jul 2008
Online Status: Offline
Posts: 47
Quote nalfein Replybullet Posted: 04 Sep 2009 at 8:18am
Hmmm CR give me and error saying that
"A number, currency amout, boolean, time, date-time, or string is expected here"

Where here is

if instr(instr(table.blahblahfield," Jamie ")>) then
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Sep 2009 at 8:21am
Sorry, that ")" should be 0... I have issues with letting go of the shift key... and apparantely doubled up on the intr...
 
This one is for the text before the name...
if instr(table.blahblahfield," Jamie ")>0 then
left(table.blahblahfield, instr(table.blahblahfield," Jamie "))
else
left(table.blahblahfield, instr(table.blahblahfield," John "))
 
This is for text starting at the name... 
if instr(table.blahblahfield," Jamie ")>0 then
mid(table.blahblahfield,instr(table.blahblahfield," Jamie "))
else
mid(table.blahblahfield,instr(table.blahblahfield," John "))


Edited by DBlank - 04 Sep 2009 at 8:24am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Sep 2009 at 8:25am

This also assumes that there is a space before and after each Name.

IP IP Logged
nalfein
Groupie
Groupie


Joined: 07 Jul 2008
Online Status: Offline
Posts: 47
Quote nalfein Replybullet Posted: 07 Sep 2009 at 1:04am
I had to put a -1 at the end of the "left row" in the first field because the CR doesn't accept the "space" character but for anithing else is working good [IMG]smileys/smiley1.gif" align="middle" />

Thank you for the help you was great [IMG]smileys/smiley1.gif" align="middle" />

Edited by nalfein - 07 Sep 2009 at 1:05am
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