Print Page | Close Window

Replacing string items

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=9564
Printed Date: 04 May 2024 at 11:48am


Topic: Replacing string items
Posted By: swatts
Subject: Replacing string items
Date Posted: 31 Mar 2010 at 4:44am
I have an if statement that pulls a value in a field, where it uses a replace statement to replace &'s with blanks. Now, here is the kicker. If the value is "other" then I want to replace "other" with the string in a box that explains what other is.

If not isnull (thisfield) then
replace (thisfield),"&"," ") but if (thisfield) = "other" then still replace "&" with " " but also replace "other" with "this is the other value."



Replies:
Posted By: lockwelle
Date Posted: 01 Apr 2010 at 3:39am
local stringvar a;
if not isnull({thisfield}) then(
  a := {thisfield};
  a := replace(a,"&", " ");
  a := replace (a, "other", {otherfield});
);
a
HTH



Print Page | Close Window