Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fixed Width - Spacing

Status
Not open for further replies.

BigDarrin

Technical User
Sep 11, 2002
17
US
Hi,
I am designing a fixed-width export report in Crystal 8.5.

I have used the formula:

numbervar requiredlength:= 35;
stringvar Address1:=trim({EInfo.address1});
numbervar currentlength:=length(Address1);
If currentlength < requiredlength then
Address1 + replicatestring(' ', requiredlength - currentlength)
else
Address1[1 to requiredlength]

The problem is that this has produced unpredictable results. On some records, it will include an extra space somewhere within the data and on other records, it works as expected. There seems to be no pattern to why it is doing it.

One other thing that I am looking into is that these are all embedded in one large text string and wonder if that could account for the unexpected results.

Any ideas what I can look at would be greatly appreciated.

Thanks,
Darrin
 
What database are you using?

I try to resolve these types of things on the database using Views or SP's.

Adjusting your formula:

numbervar requiredlength:= 35;
numbervar currentlength:=length(trim({EInfo.address1}));
If currentlength < requiredlength then
trim({EInfo.address1}) + replicatestring(&quot; &quot;, requiredlength - (length(trim({EInfo.address1})))
else currentlength >= requiredlength
left({EInfo.address1}, requiredlength)

Now some potential problems to check for might be null fields or extended ascii.

Have you tested this export to other formats? Perhaps it's export DLL related, there are monthly hotfixes at crystaldecisions.com, and they often address exports.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top