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
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