Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Suppress Text between two characters Post Reply Post New Topic
Author Message
bremen
Groupie
Groupie
Avatar

Joined: 28 May 2013
Online Status: Offline
Posts: 93
Quote bremen Replybullet Topic: Suppress Text between two characters
     Posted: 07 Aug 2014 at 1:56am
I am looking for a method to suppress data from a sting that is between two characters.  My organization places internal information between two "$" example

$Make sure Jon inspects the package$

How can I suppress that from reports that are viewed externally? 


Edited by bremen - 11 Aug 2014 at 2:56am
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 07 Aug 2014 at 3:31am
Is each instance of the string only going to have this in there once?

if so, and your string looks something like this 'Show$Make sure Jon inspects the package$ This', then do:

split({table.field}, '$')[1]
&
split({table.field}, '$')[3]

This will produce : 'Show This'

If it can be inside each instance of the string more than once, then you will probably have to do a loop which I am not an expert on.
|< /\ '][' ( )
IP IP Logged
bremen
Groupie
Groupie
Avatar

Joined: 28 May 2013
Online Status: Offline
Posts: 93
Quote bremen Replybullet Posted: 07 Aug 2014 at 4:16am
Where should I put this? 

I have a formula

mid({table.field}, 5)


Should I put this after that or in the suppress area of the field?
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 07 Aug 2014 at 5:52am
So does the mid({table.field}, 5) produce the string that has the dollar signs in it?

If so, you can create another formula that is the one I provided, however, replace the {table.field} in my formula with the name of your formula and use my formula in your report instead.
|< /\ '][' ( )
IP IP Logged
bremen
Groupie
Groupie
Avatar

Joined: 28 May 2013
Online Status: Offline
Posts: 93
Quote bremen Replybullet Posted: 11 Aug 2014 at 2:56am
So I followed your solution and received an error


"a subscript must be between 1 and the size of the array.
details: errorKind
Error in File Report
Error in formula Comments:
Split(@pocomments '$')[1]

A Subscript must be between 1 and the size of the array
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 11 Aug 2014 at 3:14am
okay, then that means the string does not have a $ in it. Use this revision:

if '$' in {@formula}
     then
(split({@formula}, '$')[1]
&
split({@formula}, '$')[3])
          else
{@formula}
|< /\ '][' ( )
IP IP Logged
bremen
Groupie
Groupie
Avatar

Joined: 28 May 2013
Online Status: Offline
Posts: 93
Quote bremen Replybullet Posted: 11 Aug 2014 at 3:48am
Many many many thanks. 


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