Print Page | Close Window

String with blanks

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22928
Printed Date: 29 Apr 2024 at 12:14pm


Topic: String with blanks
Posted By: sanchezgmc06
Subject: String with blanks
Date Posted: 24 Feb 2021 at 5:15pm
Hi

Im writing a report in SQL where I need to bring back a customer name in 20 characters.
However customer names vary and for those names with less than 20 characters I need to bring back spaces to complete the 20 characters.

Any ideas?

Thank you in advance



Replies:
Posted By: DBlank
Date Posted: 25 Feb 2021 at 3:55am
you mean you always want 20 characters with spaces to pad out the remainder?
in a formula field, concatenate the field and a string with 20 spaces and then grab the left 20 of that...
left([table.namefield]+'                    ',20)


Posted By: sanchezgmc06
Date Posted: 30 Apr 2021 at 10:55am
Thank you !! it worked



Print Page | Close Window