Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Define character length of a string Post Reply Post New Topic
Author Message
nixongear
Newbie
Newbie
Avatar

Joined: 10 Sep 2008
Location: United States
Online Status: Offline
Posts: 5
Quote nixongear Replybullet Topic: Define character length of a string
     Posted: 19 Apr 2010 at 4:01am

I am using CR 10.0

I need to create a report that has the fields broken down as follows
 
1st field character position 1-13
2nd                                   14-23
3rd                                    34-41
4th                                         42
5th                                    43-300
 
I defined the first 4 positions because they were date and number strings and required leading zeros.
 
the 5th position is a string field that is defined as (up to) 20 characters long. 
 
how do i define it as 258 characters long? 
Would the "can Grow" option work? if so would I put 2 in for the number of rows it can grow?
 
FYI this report needs to be exported to excel (2007) to ultimately become a txt file.
 
Any help would be greatly appreciated!
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 Apr 2010 at 10:53am

I can't quite follow what you are trying to do here. Can you give some examples of your raw data and how you want it to appear (or get padded)?

IP IP Logged
nixongear
Newbie
Newbie
Avatar

Joined: 10 Sep 2008
Location: United States
Online Status: Offline
Posts: 5
Quote nixongear Replybullet Posted: 20 Apr 2010 at 2:37am
       
123456789    0000210145000006156001212010 VENDOR UP TO 20 CHAR
[ 1-13           ][   14-23     ][  24-33       ][ 34-42    ][    43 - 300                  ]
 
The numbers in the brackets are the position the fields must be.
i.e position 1-13: the account number is 13 characters long, left justified with blanks at the end.
 
I have satisfied all the positions except the last one.
 
I can add the blank spaces at the end but it will only be the correct character count if the vendor field always reads 20
 
and because the field can be up to 20 characters it flucuates in size.
Is there a way to make the field read 20 characters no matter what.
The field [payee] is a string of a vendor's name. 
 
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 Apr 2010 at 3:43am
for any field you could add values together than then trim that.
For example;
left(({table.textfield} + "                    "),20)
IP IP Logged
nixongear
Newbie
Newbie
Avatar

Joined: 10 Sep 2008
Location: United States
Online Status: Offline
Posts: 5
Quote nixongear Replybullet Posted: 20 Apr 2010 at 3:52am
That worked! 
 
Thanks so much, it makes our lives much easier here!
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