replacing " in text field

Printed From: Crystal Reports Book — Forum Name: Technical Questions

Hi,

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

I tried replace, but that doesn't help.

Any ideas ?

Thanks


What do you mean by "? Is it an empty string or a null value? Is this in fields in the Select Expert?

-Dell
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             
What did you replace the " with?
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
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
);



Edited by kevlray - 28 Feb 2019 at 7:17am