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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strip Formatting

Status
Not open for further replies.

Drus

Technical User
Jan 29, 2002
43
US
I need to strip / mask a field if it matches another field within the same record.

For example, I have these two fields along with an example of their corresponding values:

{IM.Category3} = CATALANA
{IM.Category1} = 4X4
{IM.Description} = CATALANA FENDI GOLD 4x4
= CATALANA FENDI BONE
= CATALANA FENDI WHITE 2X2

I need a formula that will strip out "CATALANA" and/or "4X4" from the {IM.Description} field when it sees that {IM.Category3} and/or {IM.Category1} in that same record contains "CATALANA" and/or "4x4".

In other words, whatever the record sees in {IM.Category3} and/or {IM.Category1} must be stripped away from {IM.Description}.


This seems to work for taking out {IM.Category3}, but how to also take out {IM.Category1}?


if instr({IM.Description}, {IM.Category3}) = 0 then

{IM.Description}
else
if instr({IM.Description}, {IM.Category3}) > 0 then
if instr({IM.Description}, {IM.Category3}) = 1 then
trim(mid({IM.Description}, instr({IM.Description}, {IM.Category3}) +len({IM.Category3})))
else
if instr({IM.Description}, {IM.Category3}) > 1 then

left({IM.Description}, instr({IM.Description}, {IM.Category3})-1)
+trim(mid({IM.Description}, instr({IM.Description}, {IM.Category3}) +len({IM.Category3})))
&ru
 
Use something like this:
----------------------------------------------
Replace ({IM.Description}, IM.Category3}), "");
Replace ({IM.Description}, IM.Category1}), "");
----------------------------------------------

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
I get errors with what you gave. Maybe I misunderstood. Do you mean to place those formulas inside my existing formula somewhere?

&ru
 
I meant using these as steps.

Here's the full approach as a formula:
------------------------------------------------
Local StringVar ls_temp;
ls_temp := Replace ({IM.Description}, {IM.Category3}, "");
Replace (ls_temp, {IM.Category1}, "");
------------------------------------------------
Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
My database has dates in this format:
1/21/2003
10/1/2003

I need these dates to appear in this format:
01212003 mmddyyyy
10012003 mmddyyyy




&ru
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top