×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Developing a Crystal Report in text format

Developing a Crystal Report in text format

Developing a Crystal Report in text format

(OP)
HI
I am developing a Crystal Report in text format but my columns are not aligning as to the number of spaces that are to be in each field, such as the last name field is to be 13 space field size, first name is to be 10 space field size, etc.

I have this as one of the formulas:
stringvar padSpaces:=space(250)

The following is the formula I have for each of the field names. When I try to save this formula, it is stating that the ,13)is an error in the formula. Any suggestions?

stringvar myString:="";


mystring:=
left({OFFENDERS.LAST_NAME}+{@spaces}),13)

RE: Developing a Crystal Report in text format

I just recreated your formulas and they worked fine. I think you might have a null in your name field, as unlikely as that may sound (maybe someone entered the first and last name in the same field?). Try the following:

stringvar myString := "";
stringvar lname := "";
if isnull({OFFENDERS.LAST_NAME)) then
lname := "" else
lname := {OFFENDERS.LAST_NAME);
myString := left(lname+{@spaces}, 13);

-LB

RE: Developing a Crystal Report in text format

(OP)
Thank you!! The formula now works but my columns are still not aligning. Any suggestions?

RE: Developing a Crystal Report in text format

Make sure you are using a font like Courier New that is non-proportional.

-LB

RE: Developing a Crystal Report in text format

(OP)
Thanks - that worked perfectly BUT when I go to export in text, the columns are not aligned.

RE: Developing a Crystal Report in text format

That’s a little hard to troubleshoot without more info. Try attaching your fields to each other in design mode so that they share the same grid lines. When they are attached properly, the corners will turn red. Then right click on the detail section->select all objects->right click on one of the fields->make same size->height. Then right click again->align->to baseline. Then click on the details section->fit section. Then export.

-LB

RE: Developing a Crystal Report in text format

(OP)
Thanks - After I wrote the formula, my next step directions were to take the formulas and place them in a text box - one after another. With this, it lines up one after another, when I generate it, like below, which is correct.

00000000000000 0000000(13sp) 000000(10sp)0000000000000000000000000000000000000000
00000000000000 0000000(13sp) 000000(10sp)0000000000000000000000000000000000000000
00000000000000 0000000(13sp) 000000(10sp)0000000000000000000000000000000000000000

When I took the formulas out of that text box to export it to a text format, the data does not line up correctly - also when I export it from the correct format in Crystal Reports to a text format, it comes out like this example rather than the 1st example above.

00000000000000 0000000 0000000 000 0000000000000000000000
00000000000000 0000000 00000 000 0000000000000000000
00000000000000 0000 00000 000 00000000000000000000000000

I am confused as to why when I export it to a text file that it messes up everything (looks like the second example) instead of like the 1st example. I thank you so much for your time. I have been working on this for weeks to no avail but am getting some ground thanks to you.

RE: Developing a Crystal Report in text format

I’m not sure. I’m confused by the differing numbers of zeros when comparing rows in your second example.

Have you tried exporting to different text formats? Tab-separated text, csv, text?

-LB

RE: Developing a Crystal Report in text format

I have a report where I export to text and the columns are fixed length. The basic formula for each column looks something like this.

if isnull({PS_TC_CPAS_DETAIL.MAILING_CITY})= yes
then space(30)
else {PS_TC_CPAS_DETAIL.MAILING_CITY}& space(30-length({PS_TC_CPAS_DETAIL.MAILING_CITY}))

I hope this helps.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close