Print Page | Close Window

replacing " in text field

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=22731
Printed Date: 28 Apr 2024 at 5:38pm


Topic: replacing " in text field
Posted By: Macavity
Subject: replacing " in text field
Date Posted: 20 Feb 2019 at 2:48am
Hi,

When Crystal (9) encounters " in text fields, the entire record is disgarded.

I tried replace, but that doesn't help.

Any ideas ?

Thanks





Replies:
Posted By: hilfy
Date Posted: 26 Feb 2019 at 11:32am
What do you mean by "? Is it an empty string or a null value? Is this in fields in the Select Expert?

-Dell

-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: Macavity
Date Posted: 26 Feb 2019 at 12:06pm
No, it's in a text field, eg : DRG "54 check
So when that record :
Field1   Field2   Field3                  Field4          Field5
B001    X           DRG "54 check    20190201   F01

is read Crystal disregards it.
When I use replace, Crystal prints it but everything after " is zero or blank :

Field1   Field2   Field3                  Field4          Field5
B001    X           DRG                    0             


Posted By: kevlray
Date Posted: 27 Feb 2019 at 4:25am
What did you replace the " with?


Posted By: hilfy
Date Posted: 27 Feb 2019 at 11:40am
I suspect there may be some non-visible ASCII code that is causing this issue. Instead of using Replace() you might want to do something like this:


NumberVar char := 1;
StringVar result := "";
While char <= length({Field3} do
(
if {Field3}[char] in (A..Z, a..z, 0..9) then
    result := result + {Field3}[char]
);


I don't know if this syntax is exactly correct, but the thought is to go through the string and only keep characters that are alpha-numeric.

-Dell

-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: kevlray
Date Posted: 28 Feb 2019 at 7:17am
You forgot to increment Char
NumberVar char := 1;

StringVar result := "";
While char <= length({Field3} do
(
if {Field3}[char] in (A..Z, a..z, 0..9) then (
    result := result + {Field3}[char];

)
  char := char +1
);




Print Page | Close Window