views:

91

answers:

1

I am using this following text to delete brackets and text inside the brackets; I need to go threw the entire memo field and it stops after it finds and deletes the first set of brackets and text.

if right({table.col},1) = "]" then left({table.col},instr({table.col},"[")-1) else {table.col}

Any suggestions...

A: 

This tested well with Crystal2008, not sure what version you are using, it also would need some error checking to handle mismatched bracket pairs, but it may offer some food for thought:


Dim workString as String
Dim bracketedText as string

if (InStr({table.col},"[") > 0) then
  workString = {table.col}
  while(InStr(workString,"[") > 0 )
    bracketedText = "[" + ExtractString(workString,"[","]") + "]"
    workString = replace(workString,bracketedText,"")
  Wend
  Formula = workString
else
  Formula = {table.col}
End If

SqlACID