Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: removing character returns Post Reply Post New Topic
Author Message
CCope
Newbie
Newbie
Avatar

Joined: 16 Jun 2008
Location: United States
Online Status: Offline
Posts: 4
Quote CCope Replybullet Topic: removing character returns
     Posted: 16 Jun 2008 at 6:28am

Hi,

I'm fairly new at this, but trying to remove what appears to be a carriage return and/or line feed  at the end of each line, they appear as little boxes when we export to text document?
 
How do we also state which character position to start each column and how many characters are in each column?
 
Ccopes
IP IP Logged
twinkle
Newbie
Newbie
Avatar

Joined: 16 Jun 2008
Location: United Kingdom
Online Status: Offline
Posts: 32
Quote twinkle Replybullet Posted: 16 Jun 2008 at 11:43am
try function "trim"
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 16 Jun 2008 at 2:10pm
Trim is a good idea, but it only removes spaces from the end of the line. To get rid of the CR-LF characters, use the Left() function. A formula like this is probably be what you need.
Left({table.field}, Len({table.field})-2);

This uses the length of the field to determine how many characters to return. Thus, it chops off the last two characters from the field.

I have three full chapters about writing formulas in my Encyclopedia book. You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
CCope
Newbie
Newbie
Avatar

Joined: 16 Jun 2008
Location: United States
Online Status: Offline
Posts: 4
Quote CCope Replybullet Posted: 17 Jun 2008 at 5:39am
Good Morning,
 
Thanks for taking the time to help me.
 
But when I use Left({table.field}, Len({table.field})-2)
 
it tells me it needs a string?
 
Left({bank_check.bc_dt}, Len({bank_check.bc_dt})-2)
 
What shall I do next?
Ccopes
IP IP Logged
twinkle
Newbie
Newbie
Avatar

Joined: 16 Jun 2008
Location: United Kingdom
Online Status: Offline
Posts: 32
Quote twinkle Replybullet Posted: 17 Jun 2008 at 8:36am
try... If NumericText (Mid(({bank_check.bc_dt}, 2,1}) = true
then Left({bank_check.bc_dt}, Len({bank_check.bc_dt})-2)
IP IP Logged
CCope
Newbie
Newbie
Avatar

Joined: 16 Jun 2008
Location: United States
Online Status: Offline
Posts: 4
Quote CCope Replybullet Posted: 17 Jun 2008 at 1:48pm

Hi There,

Thanks again, but now it asks me for a ) see below colored area, then when I insert it, more ) are requested and so on.

 If NumericText (Mid(({bank_check.bc_dt}, 2,1}) = true
then Left({bank_check.bc_dt}, Len({bank_check.bc_dt})-2)
 
Help!Confused 
Ccopes
IP IP Logged
twinkle
Newbie
Newbie
Avatar

Joined: 16 Jun 2008
Location: United Kingdom
Online Status: Offline
Posts: 32
Quote twinkle Replybullet Posted: 17 Jun 2008 at 2:36pm
try this..
If NumericText (Mid({bank_check.bc_dt}, 2,1}) = true
then Left({bank_check.bc_dt}), Len({bank_check.bc_dt})-2)
 
if this doesnt work then trial and error
 
also look at the other functions such as Stringvar  etc
 
!
 
Ps im still looking for someone that knows how to Rank!
 
 
 


Edited by twinkle - 17 Jun 2008 at 2:46pm
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 17 Jun 2008 at 2:58pm
It appears that you are the fields you are trying to remove a CR LF from are not strings. Thus, there shouldn't be a CR-LF character in them. I think your problem might be related to something else then.

Re the new code you posted and the error message, I don't see how this code will help you because the field is either a string or not a string. But anyway, the error is because you have a "}" where you should have  a ")" right after the ",2,1" part on the first line. Also, you have two parentheses after the "Mid". I don't know why this is b/c there should only be one.

 If NumericText (Mid({bank_check.bc_dt}, 2,1)) = true
then Left({bank_check.bc_dt}, Len({bank_check.bc_dt})-2)

Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
CCope
Newbie
Newbie
Avatar

Joined: 16 Jun 2008
Location: United States
Online Status: Offline
Posts: 4
Quote CCope Replybullet Posted: 18 Jun 2008 at 10:22am
Thanks for the tip.
 
I'm still unable to get this to work though. 
 
I'm trying to export this report into an ascii format and it is creating an extra line inbetween the info as well as creating a space starting at the second line and so on.  And it is giving me spaces in between each item, I would like to specify where to start for each item and where to end for each item so there are no spaces.
 
Any one know what I should do?
 
Example:
 
005555555555   00   000055555   0000000000555555 06102008
 
 005555555555   00   000055555   0000000000555555 06102008 
 
 005555555555   00   000055555   0000000000555555 06102008 
 
 005555555555   00   000055555   0000000000555555 06102008 
 
 005555555555   00   000055555   0000000000555555 06102008
 
 
 


Edited by CCope - 18 Jun 2008 at 10:23am
Ccopes
IP IP Logged
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