Dear BeckyBear,
Here is are SQL expression that I finally came up with that extracts what you are looking for! I have a memo field in my database called Incident.Incident Resolution that is a memo field so I used that in the examples.
(CRORA8 v3.6 driver CRORA815.dll)
I called this %GetName
This one gets the text in the brackets (it includes the brackets)
Cast(Rtrim(SUBSTR(Incident."Incident Resolution", INSTR(Incident."Incident Resolution",'[',1,1),( INSTR(Incident."Incident Resolution",']'))-(INSTR(Incident."Incident Resolution",'['))+1)) as varchar(250))
result: [Some Name]
Note: I couldn't get this to work until I cast it as a varchar!
This one tests for the existence of "CP\" in the beginning of the memo field
I called this %TestValue
INSTR(Incident."Incident Resolution",'CP/',1,1)
Result: 1 if true 0 if false.
So then you create this formula:
if {%TestValue} = 0 then {%GetName}
Hope that this helps, it was the best that I could come up with.
Ro
Rosemary Lieberman
rosemary@microflo.com,
Microflo provides expert consulting on MagicTSD and Crystal Reports.