Print Page | Close Window

How to remove (redact) names

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Tips and Tricks
Forum Discription: Have you learned some great tricks to share with the group? Post them here!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=20071
Printed Date: 18 May 2024 at 12:07am


Topic: How to remove (redact) names
Posted By: gilinnc
Subject: How to remove (redact) names
Date 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.



Replies:
Posted By: kevlray
Date 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},"") )


Posted By: gilinnc
Date 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.



Posted By: gilinnc
Date 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?
 


Posted By: DBlank
Date 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)


Posted By: kevlray
Date 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. 


Posted By: gilinnc
Date 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!
 
 



Print Page | Close Window