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

how can i insure fixed precision when exporting to csv text files?

Status
Not open for further replies.

uscitizen

Technical User
Jan 17, 2003
672
US
well, my subject heading pretty much represents my query....

i have some tables with height, weight and dosages and i'm exporting these variables to text files via queries. my downstream recipients are blueprinting requirements for height and weight to have ####.# and dosage ################.### - on input....meaning weight can be in the thousands and dosages in the (correct me if i'm wrong) hundreds of billions. the former with 1 and the latter with 3 digits of precision. leading zeroes aren't wanted in the resulting exported text file, but numbers are expected to look like 99.0 124.0 for weight/height and 878787.120 or 615158.900 for dosages.

any ideas?

“The philosophy of the school room in one generation will be the philosophy of government in the next." --- Abraham Lincoln
 
Use the Format command as part of the column specification. Dosage:Format([Dosage_field],"999999.999") and Weight:Format(Weight_field,"#99.9") to drop a leading zero. If you need to output a fixed width field, use Amount:Right("000000000000000" & Amount_field,15) where 15 is the width of the field.
 
i don't know if, given my hasty description, i got my meaning across..

what i was trying to say was that in the case of dosages, the export file needed to have three significant digits past the decimal and the height/weight fields needed to have just one. and that when their values was integers w/o fractional/decimal parts, the export file would show their values with either three (or just one) zero past the decimal part, and also that the data needed to be exported not as string values (with quotations around them) but as numbers (w/o quotations); that said, will the above do that?

“The philosophy of the school room in one generation will be the philosophy of government in the next." --- Abraham Lincoln
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top