replacing " in text field
Printed From: Crystal Reports Book — Forum Name: Technical Questions
Posted By: Macavity — 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
Posted By: hilfy — 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
Posted By: Macavity — 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 — 27 Feb 2019 at 4:25am
What did you replace the " with?
Posted By: hilfy — 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
Posted By: kevlray — 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 );
Edited by kevlray - 28 Feb 2019 at 7:17am
|