Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing brackets/text 1

Status
Not open for further replies.

jlclancy

Technical User
May 22, 2009
13
thread767-1463028

How could you get it to keep looking through the memo field for additional brackets/text to remove??
 
This should work...

replace(replace({yourtable.field},"[",""),"]","")

-- Jason
"It's Just Ones and Zeros
 
Yes; I need to delete the text as well. I was using this, but after it finds and deletes the first set of brackets and text it does not continue through the memo field:

if right({tbl.col},1) = "]" then
left({tbl.col},instr({tbl.col},"[")-1)
else
{tbl.col}
 
The one I posted does. It replaces ALL [ with nothing and ALL ] with nothing.

Try it...

Look up REPLACE in Crystal Help files. If no argument is specified the function replaces ALL instances of the match string.

-- Jason
"It's Just Ones and Zeros
 
Please don't start new threads on the same topic. This appears to be a continuation of thread767-1550105. You need to show some sample data as it currently appears and then show how you would like it to appear.

-LB
 
Jason,

It does remove all instances of the brackets through out the memo field; it does not remove the text.

Julie
 
what text are you trying to remove?

-- Jason
"It's Just Ones and Zeros
 
Here is a sample of what might appear in the memo field:
Julie just ran three miles and found her time was five/six seconds better then last time [5/25/2009 18:22:00 : jlclancy] T cleared [5/26/2009 5:22:00 : torgermj]

This type of text, with the time, date and comment can go on and on; the lanid can change.

The code below, which is nested, deletes the 1st set of brackets/txt; it will not continue looking and removing (and the code Jason posted does remove ALL brackets; not the text in between).

if right(output,1) = "]" then
left(output,instr(output,"[")-1)
else
(output);

 
...also, the data source is access.
 
Try:

stringvar array x := split({table.memo},"]");
numbervar i;
numbervar j := ubound(x);
stringvar y := "";
for i := 1 to j-1 do(
y := y + trim(extractstring(x,"","["))+"; "
);
if len(y) > 2 then
left(y, len(y)-2)

I didn't know how you wanted this to display. I added in a semicolon so that it would make sense to me. It would look like this:

Julie just ran three miles and found her time was five/six seconds better then last time; T cleared

-LB
 
Well, it is not due to your trouble clarifying what help is needed where!

thank you,
Julie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top