Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Remove after 2nd space in a text string Post Reply Post New Topic
Author Message
patgio
Newbie
Newbie


Joined: 28 Aug 2012
Online Status: Offline
Posts: 2
Quote patgio Replybullet Topic: Remove after 2nd space in a text string
    Posted: 28 Aug 2012 at 3:50am
Hi,
I'm using CRXI

I have a field which contains text such as:
"Item one has this description"
"The second item has different text"
"And so does the third"
"And on and on"

I would like my report to remove all text after the 2nd space so that the report would have:
Item one
The second
And so
And on

In the report, I'm using format field; display string with the following formula:

extractstring({vRptScheduledExams.ExamDesc},"",mid({vRptScheduledExams.ExamDesc},
instr({vRptScheduledExams.ExamDesc}," ")+0))

This removes all text after the first " " (space).
It returns only:
Item
The
And
And
How do I advance the formula to remove after the second space?
Thanks for your help.

Patrick




Edited by patgio - 28 Aug 2012 at 5:54am
IP IP Logged
z9962
Senior Member
Senior Member
Avatar

Joined: 04 Jul 2012
Online Status: Offline
Posts: 161
Quote z9962 Replybullet Posted: 29 Aug 2012 at 12:01am
try this
 
left({vRptScheduledExams.ExamDesc},instr((instr({vRptScheduledExams.ExamDesc}," ")+1),{vRptScheduledExams.ExamDesc}," ")-1)
 


Edited by z9962 - 29 Aug 2012 at 12:01am
IP IP Logged
patgio
Newbie
Newbie


Joined: 28 Aug 2012
Online Status: Offline
Posts: 2
Quote patgio Replybullet Posted: 29 Aug 2012 at 1:42am
wow.. that is amazing.
Thank you very much.
It works perfectly.
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.