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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pad space if needed 1

Status
Not open for further replies.

JBourne77

IS-IT--Management
Jan 21, 2008
153
US
I have 3 specific columns I am calling in a SQL Query that will be merged into one string in Crystal Reports and they have to be a total length (between the 3) = 75 characters.

My specific coding on these 3 fields in SQL looks like:

Code:
ISNULL(LEFT(ic.ListName, 25), 'xxxxxxxxxxxxxxxxxxxxxxxxx') AS [Primary Payer] ,
ISNULL(LEFT(ic2.ListName, 25), 'xxxxxxxxxxxxxxxxxxxxxxxxx') AS [Secondary Payer] ,
ISNULL(LEFT(ic3.ListName, 25), 'xxxxxxxxxxxxxxxxxxxxxxxxx') AS [Third Payer]

My issue:

I had a [Primary Payer] = 'Zales' and a [Secondary Payer] = 'Aetna Life and Casualty' and a [Third Payer] = 'United Health Care SLCit'.

Is it possible to take the LEFT 25 characters and if not equal to a total of 25 characters pad it with blank spaces in crystal?

My current Formula's are such:
Code:
if {Data.Primary Payer}= 'xxxxxxxxxxxxxxxxxxxxxxxxx' then '                         '
else {Data.Primary Payer}

Code:
if {Data.Secondary Payer}= 'xxxxxxxxxxxxxxxxxxxxxxxxx' then '                         '
else {Data.Secondary Payer}

Code:
if {Data.Third Payer} = 'xxxxxxxxxxxxxxxxxxxxxxxxx' then '                         '
else {Data.Third Payer}
 
there is a space function in crystal but not sure it will work for your purpose.

Code:
if {Data.Primary Payer}= 'xxxxxxxxxxxxxxxxxxxxxxxxx' then space(25)
else {Data.Primary Payer}

You could also use a conditional formula to white the contents of the field.

Crystal Reports 8.5
Microsoft Office 2003
Informix DB
 
I need to add the spacing to the end of payer names not 25 characters. So like my example: 'zales' I would need to see 'zales '
 
You could use:

left({table.field},25) + (
if len({table.field}) < 25 then
space(25-len({table.field}))
)

However, you would have to format the formula to a nonproportional font like Courier New.

-LB
 
lbass -

How do I format the formula to a nonproportional font like Courier New and what is the reason behind using this font versus arial?

In crystal, I took the create text object (ab - button) - and dropped in all my fields one after another with no spacing then my three formulas and then some final fields. When I export my document and put it into a text file, I am coming up with 24 additional spaces at the end of my payers. I changed the text on the entire field to Courier new as well. I am wondering if I shouldn't create one formula for all my fields and spacing requirements and then pull my one formula into the report field. I hope i made sense there ... your help is deeply appreciated!
 
Lbass -

Please disregard ... It works like a charm!!! I am so happy and appreciative!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top