INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• 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.

Business Objects: Crystal Reports 1 Formulas FAQ

Formula Help

 How to print text vertically by HowardHammerman faq767-1986 Posted: 30 May 02 A tip in the May, 2002 issue of the Crystal Care eNews for Crystal Reports newsletter showed how to take the text in a text object and print the letter vertically.  BUT suppose you wanted to print a character field from your database in the same way?In the following example we are using a For loop. This is available in Crystal 8.5 and above. We will print the field NAME vertically.Here is how to do it:Create a formula field with the following syntax:WhilePrintingRecords;numbervar stlen := length(trim({EMPLOYEE.NAME}));numbervar k ;local stringvar output;for  k := 1 to  stlen  do (output := output + {EMPLOYEE.NAME}[k]+chr(13););output := output + chr(13)Insert the formula in your report and then right-click, pick ôFormat Fieldö and Check the ôcan growö property.Here is how it works:  Line 2 stores the length of the field striped of blanks into the variable stlen.Line 3 declares a number variable, k. We will use this to control the number of loops.Line 4 declares a string variable to use to store the output. It is important to include the ælocalÆ qualifier or the field will keep growing from record to record!Line 5 sets up the loop.  We will go through the loop the number a number of times equal to the current value of stlen.Line 7 parses the database field. The sub-string operator [ ] (brackets) picks out the kth  letter of the field and appends it to the growing output string field. After each letter we are inserting a hard return. The CHR function translates a number to its ASCII equivalent. CHR(13) is equivalent to pressing the ôreturnö key on your keyboard.Line 9 adds one more return at the end of the string for formatting purposes. Back to Business Objects: Crystal Reports 1 Formulas FAQ Index Back to Business Objects: Crystal Reports 1 Formulas Forum

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:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!