Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: replacing " in text field Post Reply Post New Topic
Author Message
Macavity
Groupie
Groupie


Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
Quote Macavity Replybullet Topic: replacing " in text field
    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


IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet 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
IP IP Logged
Macavity
Groupie
Groupie


Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
Quote Macavity Replybullet 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             
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 27 Feb 2019 at 4:25am
What did you replace the " with?
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet 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
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet 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
);



Edited by kevlray - 28 Feb 2019 at 7:17am
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.