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

Export Numeric Field 3

Status
Not open for further replies.

kpeak

IS-IT--Management
Mar 10, 2004
12
US
I need help exporting a numeric field, length of 11 with 5 decimals to a text file and have it appear with leading spaces, 4 decimals and show the decimal point. The field contains hours worked (i.e. 40.00000)
Can anyone help me with the formula to do this export?
Thanks!

 
What is the length of the field you want to export? Since you want to eliminate one decimal, do you want a field length = 10?

-LB
 
You cannot export it in a different format to the way it appears in the report(AFAIK).

You need to create a formula field which formats it the way you want.
For example:(there are 11 spaces between the first pair of quotes)

right(" " & trim(ToText ({Orders.Order Amount},4,"")),11)
 
Give this a try...

WhilePrintingRecords;
Stringvar x;
Numbervar y;
Stringvar z;
// Creates text string to 5 decimal spaces and omits the thousands separator
x := totext({TLORDER.CHARGES},5,'');
y := 15-len(x);
z := space(y) + x;

Hope this helps...

D
 
Oops... TLORDER.CHARGES should be the numeric field that you are exporting. Sorry.

D.
 
Note correction to y variable, should be 11.

WhilePrintingRecords;
Stringvar x;
Numbervar y;
Stringvar z;
// Creates text string to 5 decimal spaces and omits the thousands separator
x := totext({table.field},5,'');
y := 11-len(x);
z := space(y) + x;
 
If you're saying that you want the field padded with spaces to the left, and always have a 4 digit precision, try:

space(11-len(totext({table.number},4,"")))+totext({table.number},4,"")

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top