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

Exporting Data to text file

Status
Not open for further replies.

aproddut

Programmer
Oct 29, 2002
15
US
Exporting data to a text file truncates the trailing spaces. How do i deal with this ?

I also tried the following

"ABCD" + SPACE(75) + CHR(13)

The purpose is to feed the output file to the mainframe in a fixed length format.

When used the above in the formula and export it to a text file it still truncates the trailing spaces.

Please help if you know the solution.

Thanks
Ash
 
What about creating the formula where it is "abcd"+" "
you can force field length by doing this
-Bruce Seagate Certified RCAD Specialist.
-Bruce Thuel-Chassaigne
roadkill150@hotmail.com
 
Hello,
Thanks for the response. I cant use the " " because I would not know the lenthg of each record at design time.

For eg the data could be like be as below.

"AAAAAAAAAAAAA"
"DDDD"
"
so I cant really use as you suggested. Please help.

Thanks
 
Hiya,
here is the formula/info for creating fixed length fields as you requested:

You can use this formula to create a fixed width field. You will need to substitute {Customer.Customer Name} with the name of your database field:

// Start Formula
// Specify the desired length of the field in characters (this example uses 20)
numbervar requiredlength:= 20;

// Get the current length of the database field.
numbervar currentlength:= length({Customer.Customer Name});

// Check the length of the database field compared to the required length
if requiredlength < currentlength then
// truncate fields which are longer than the required length
{Customer.Customer Name}[1 to requiredlength]
else
// pad the field length with underscore characters (_)
// for readibility and testing, any added spaces are denoted using underscore characters (_)
{Customer.Customer Name} + replicatestring(&quot;_&quot;, requiredlength-currentlength)

// End Formula


Insert the above formula on the report instead of the database field.

For readability, any added spaces are denoted using underscore characters (_). If you wish to use blank spaces instead, replace the last line of code in the formula with the following:

{Customer.Customer Name} + replicatestring(&quot; &quot;, requiredlength-currentlength)

-Bruce Seagate Certified RCAD Specialist.
-Bruce Thuel-Chassaigne
roadkill150@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top