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!

Symbol appearing in exports.

Status
Not open for further replies.

woodyinoz

IS-IT--Management
Jan 8, 2002
215
GB
Hi all,

I have posted this question before but now it's really beginning to bug me and I need a solution pretty quickly!

I am simply trying to use the following code to export a table into a CSV file.

exportspreadsheet (":pRIV:part_1.db", "C:\\Conv\\New Parts.csv", False )

I have also tried using

exportASCIIVar ( ":pRIV:part_1.db", "c:\\Conv\\New Parts.csv", ",")

both of these methods get the information into CSV files as I would want except for one minor detail. They both create a new line at the bottom of the file with a  symbol in it.

This is causing me problems as I am trying to use the CSV files to actually import information into another database and this symbol is making the import crash.

Any suggestions would be great,

Thanks in advance,

Woody
 
I've noticed this too, Woody. The only solution I can think of is to do an export using OPAL and writeLine().

Mac :)

"There are only 10 kinds of people in this world... those who understand binary and those who don't"

langley_mckelvy@cd4.co.harris.tx.us
 
Mac,

I know that the following code will output the first three firlds of my table into a text file. But, how do I output all fields without going through all 120?!

tc.open( DATAFILE )

ts.open( TEXTFILE, "nw" )

scan tc:

message("Writing ", tc.recNo(), " of " , tc.nRecords(), "...")
ts.writeline( "\"", tc.(1), "\",",
"\"", tc.(2), "\",",
"\"", tc.(3), "\"," )

endscan

ts.commit()
ts.close()


Hopefully you'll have a solution for me!

Thanks,

Woody
 
I would probably do it like this:

Code:
var
	ts	textStream
	tc	tCursor
	fieldnames Array[] String
	cNum	number
	myString	string
endvar


ts.open("test.text","nw")

tc.open("mydb.db")
tc.enumFieldnames(fieldNames)

cNum = 1

scan tc:

	myString = ""
	while cNum <= 120 ; the number of fields

		myString = myString+"\""+tc.(fieldnames[cNum])
		if cNum = 120 ; last field
			then	myString = myString+"\""
				else	myString = myString+"\","
		endif
		cNum = cNum+1

	endWhile

	ts.writeLine(myString)
	cNum = 1
	
endscan

tc.close()
ts.close()

endMethod

Mac :)

&quot;There are only 10 kinds of people in this world... those who understand binary and those who don't&quot;

langley_mckelvy@cd4.co.harris.tx.us
 
PS - I tested that code on a 26 field table with about 500 records. I didn't have any 120 field tables to test on.



Mac :)

&quot;There are only 10 kinds of people in this world... those who understand binary and those who don't&quot;

langley_mckelvy@cd4.co.harris.tx.us
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top