Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: replace data from string Post Reply Post New Topic
Author Message
spikestertje
Newbie
Newbie


Joined: 14 Oct 2011
Location: Netherlands
Online Status: Offline
Posts: 5
Quote spikestertje Replybullet Topic: replace data from string
     Posted: 14 Oct 2011 at 3:14am
I'm a newbie to the forum and hope you can help me with the following problem I have.
A record can be closed automatically or manually. When closed manually the operator enters his comments. But when closed automatically, I need to leave the comments blank.
The field looks like : [#7618|18160200044]
The first two digits are always the same "[#".

What I would like to is to make an SQLexpression, to look for these strings and delete the sting for the report.

I can filter on the "[#" with the startswith function, but not replacing the value. I also tried it with IF - ELSE - THEN function, but then values are also filtered out.

Can anybody help me?

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 14 Oct 2011 at 4:38am
if you want to remove the comments, but not the [# you could use something like:
 
if automatic then
 "[#]"
else
  {table.field}
 
if you are just after the information inside the brackets, this should work
 
mid({table.field}, 3, len({table.field}-3))   //-3 for the []#
 
Hopefully I understood what you were after.
IP IP Logged
spikestertje
Newbie
Newbie


Joined: 14 Oct 2011
Location: Netherlands
Online Status: Offline
Posts: 5
Quote spikestertje Replybullet Posted: 14 Oct 2011 at 5:21am
Thank you for the quick answer, but I think  I need it a little different.

All records that start with [#, I would like to show them blank, as if there was no comment applied for that record.


IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 17 Oct 2011 at 12:06pm
np...
 
if instr({table.comment}, "[#") = 1 then
 ""
else
 {table.comment}
 
HTH
IP IP Logged
spikestertje
Newbie
Newbie


Joined: 14 Oct 2011
Location: Netherlands
Online Status: Offline
Posts: 5
Quote spikestertje Replybullet Posted: 24 Oct 2011 at 3:36am
Thank you, it worked
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