Tips and Tricks
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Tips and Tricks
Message Icon Topic: How to remove (redact) names Post Reply Post New Topic
Author Message
gilinnc
Newbie
Newbie
Avatar

Joined: 18 Oct 2011
Online Status: Offline
Posts: 11
Quote gilinnc Replybullet Topic: How to remove (redact) names
    Posted: 30 Sep 2013 at 11:45am
Hi folks, I hope this is a simple solution. I've look in the manuals and googled for the solution and I could not find what I was looking for. Here is my situation. I have a note field in the SQL database that has multiple sentences. However, at the end of each sentences there will be a "[user_name]" without quotes. I would like to be able to trim out the user_name on the report. How do I do this?

I appreciate your time and effort on this matter.

We are trying to create a media report, but do not want to give out to the public the user names.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 30 Sep 2013 at 12:34pm
I am not sure if this works on note fields, but the replace function works on text fields (example: Replace({note field},{User Name},"") )
IP IP Logged
gilinnc
Newbie
Newbie
Avatar

Joined: 18 Oct 2011
Online Status: Offline
Posts: 11
Quote gilinnc Replybullet Posted: 30 Sep 2013 at 1:50pm
Let me rephrase the issue, here is an example of the note field content: White male subject was last seen wearing blue pants, white shirt with a baseball cap. [KEWLRAY]

So, I need to redact the word between the brackets inside the note field. I thought TRIM would work, but I do not see any solutions on the net for that. The bracket is just a stamp to track users who enters descriptive notes. It is not a field itself.

I will try your solution Kewlray...Thanks.



Edited by gilinnc - 30 Sep 2013 at 2:05pm
IP IP Logged
gilinnc
Newbie
Newbie
Avatar

Joined: 18 Oct 2011
Online Status: Offline
Posts: 11
Quote gilinnc Replybullet Posted: 01 Oct 2013 at 4:39am
Kevlray -  I tried your solutions and it works for 1 character, however I need to be able to replace all the characters between the two brackets "[" and "]".
 
Ex: White male subject, wearing blue pants, white shirt last seen on Main street. [10/01/13 10:37:25 Joe Smith]
 
Could the replace with trim work together?
 


Edited by gilinnc - 01 Oct 2013 at 4:39am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 01 Oct 2013 at 4:50am
since it is always at the end you can use a left() and instr() together as another solution
left(field,instr(field,"[")-1)
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 01 Oct 2013 at 5:12am
The datetime stamp can be an issue.  I thought the user name was field that you could put into the function.  DBlank's solution should work. 
IP IP Logged
gilinnc
Newbie
Newbie
Avatar

Joined: 18 Oct 2011
Online Status: Offline
Posts: 11
Quote gilinnc Replybullet Posted: 01 Oct 2013 at 5:20am
That's perfect, I have been looking throught the formula language reference and I did not think Left would work.  I have a long way to go.
 
Thank you Kevlray - your solutions work very well for me.  My peers will be happy with an updated CR printout!
 
 


Edited by gilinnc - 01 Oct 2013 at 5:43am
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.031 seconds.