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

Exporting Text 1

Status
Not open for further replies.

duquesne

Technical User
Dec 17, 2001
1
US
I am trying to export fixed width text. I need one of the fields to be right justified...ugh! However, I can not figure out how to right justify if it is type "text" and I can't export to fixed width if all fields aren't in "text" format. Any ideas??
 
I can't just see how you can directly right justify - seems an odd ommission. Any way you can do it your self. You want to create a new field which has your data on the right.

The basic steps are

Trim the data to remove blanks. TRIM
Get the length LEN
You'll need a variable or literal that is all blanks. Calculate what left portion ie number of blanks you need from this and concatenate this onto the front of the trimmed data. Your data now gets pushed to the right boundary. For field size 20:

Something like
LEFT(blankfield,(20-LEN(TRIM(field)))) & TRIM(field)
 

Use the RIGHT and SPACE functions as follows to Right justify text. The example will right justify a 50 character column. Adjust as needed.

Right(Space(50) & [ColName],50) Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top