Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copy to file type csv
Message
De
18/05/2007 10:04:05
James Beerbower
James Beerbower Enterprises
Hochheim Am Main, Allemagne
 
 
À
18/05/2007 09:44:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01226670
Message ID:
01226716
Vues:
17
Hi Gaylen,

Glad the copy delimted works for you. However copy delimited may not do every sort of CSV that customers want. If you should have the misfortune to encounter the weird ones you can also use low level file functions to get the precise requirements.

For example:
lparameters lcFile,lcOutputFile

afields(laFields,m.lcFile)
erase (m.lcOutputFile)
m.lnHandle=fcreate(m.lcOutputFile)
m.lcSeparator = ";"

local m.i
select (lcFile)

scan
	lcLine = ""
	for i = 1 to alen(laFields,1)
			m.lxValue =evaluate(laFields(i,1))
		if !empty(m.lxValue)
			m.lcValue = ALLTRIM(transform(m.lxValue))
			m.lcValue = strt(strt(STRTRAN(m.lcValue,"'",""),["],""),[,],"")
			m.lcValue  = ["]+alltrim(m.lcValue) +["]
		else
			m.lcValue = ""
		endif	
		m.lcLine = m.lcLine+m.lcValue+m.lcSeparator
	endfor
	m.lcLine = substr(m.lcLine,1,rat(m.lcSeparator,m.lcLine)-1)
	fputs(m.lnHandle,m.lcLine)
endscan
fclose(m.lnHandle)
select (m.lnSelect)
Mind you, copy to... -> filetostr -> manipulate -> strtofile is another way to skin the cat.

>Thanks Edward
>
>That works just fine. It eliminates the header and encloses the text fields with " ".
>
>To the others also that quickly responded I say
>
>Thanks!!
>Gaylen
>
>>>I need to create a comma delimited file from a table with " " around the alpha fields. Copy to xxx type csv works fine except it creates a header record of the fields. The bank wants the csv file without the header.
>>>
>>>Any quick fixes for this.
>>>
>>>Gaylen
>>
>>Try COPY TO ... DELIMITED
James Beerbower
James Beerbower Enterprises
Frankfurt, Deutschland
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform