Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Export text with field name
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00901618
Message ID:
00901625
Views:
12
>Hi all,
>
>Does anybody now, how can I convert a dbf to text and have the field names in the first row.
>
>Thank you,
>Ali

You could do a standard LIST TO FILE kind of deal. Or you could roll your own. Something like this:
*-- I will assume that we are using the current open table

LPARAMETERS tcOutFile

SET TEXTMERGE TO (tcOutFile)
SET TEXTMERGE ON NOSHOW

LOCAL lnCounter

FOR lnCounter = 1 TO FCOUNT()
	\\<<ALLTRIM(FIELD(lnCounter))>>
	
	IF lnCounter < FCOUNT()
		\\,
	ENDIF
ENDFOR

SCAN
	FOR lnCounter = 1 TO FCOUNT()
		\\<<TRANSFORM(EVALUATE(FIELD(lnCounter)))>>
		
		IF lnCounter < FCOUNT()
			\\,
		ENDIF
	ENDFOR
ENDSCAN

SET TEXTMERGE OFF
SET TEXTMERGE TO
MODI COMM (tcOutFile) NOWAIT
Hope this helps.

Menachem
Menachem Bazian, CPA
President
BC Consulting Services, Inc.
973-773-7276
Menachem@BazianCentral.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform