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!

EXPORTING COMMA DELIMITED FILES 2

Status
Not open for further replies.
Jul 7, 2003
95
US
I am exporting a file that has to be comma delimited. NO quotes, just the comma.

My fields are Nickname,fullname,firstname... etc

My results are as follows

,Nickname,,,FullName,,,FirstName,,,

Why am I getting extra commas where no fields exist and what command should I be using? Has anyone else had this problem before?

Thanks in advance,

Will
 
Kudos to you DSUM!!!

That command is a workaround I can use!!!

Thank you, thank you.

Will
 
DSummZZZ,

I hate to see a helpful post go without a star. So here you go.

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
Hold your horses....

SET HEADING OFF
list off NICKNAME+ "," +NAME+ "," +FIRST+ "," +LAST+ "," +TITLE+ "," +COMPANY+ "," +DEPT+ "," +ADDRESS+ "," +ADDRESS2+ "," +CITY+ "," +ST+ "," +ZIP+ "," +PHONE+ "," +EXT+ "," +FAX+ "," +PAGENUM+ "," +CELLNUM+ "," +COUNTRY+ "," +EMAILER+ "," +VERIFYFLAG+ "," +ACCEPTFLAG+ "," +VALIDFLAG+ "," +RESIDEFLAG+ "," +CUSTOMID+ "," +REFERENCE+ "," +SERVTYEP+ "," +PACKCODE+ "," +COLLECTCOD+ "," +BILLCODE+ "," +ACCTNO+ "," +DUTYBILL+ "," +DUTYBILL2+ "," +CURRENCY+ "," +INSIGHT+ "," +GROUNDREF+ "," +GROUNDS+ "," +GROUNDS2+ "," +GROUNDS3+ "," +EXALERT+ "," +EXEMAIL+ "," +PARTNER+ "," +NETRETURN+ "," +CUSTOMSID+ "," +ADDRESSYTP+ "," +F1+ "," +F2+ "," +F3+ "," +F4+ "," +F5+ "," +F6+ "," +F7+ "," +F8+ "," +F9+ "," +F10+ "," +F11+ "," +F12+ "," +F13+ "," +F14+ "," +F15+ "," +F16+ "," +F17+ "," +F18+ "," +F19+ "," +F20+ "," +F21+ "," +F22+ "," +F23+ "," +F24+ "," +F25

I am returned the message "expression is too complex"

geezzzzz.. I need to just get another line of work.. LOL
 
I think you may need to break it into sections using the ;. The line is probably too long:

SET HEADING OFF
list off ;
NICKNAME+ "," +NAME+ "," +FIRST+ "," +LAST+ "," ;
TITLE+ "," +COMPANY+ "," +DEPT+ "," +ADDRESS+ ;
ADDRESS2+ "," +CITY+ "," +ST+ "," +ZIP+ "," +PHONE+ "," ;

...and so on

By the way, thanks for the star.



-Dave S.-
[cheers]
Even more Fox stuff at:
 
Hello..

SELECT myTable
tString = ''
SCAN
tString = tstring + ;
NICKNAME+ "," +NAME+ "," +FIRST+ "," + ;
LAST+ "," +TITLE+ "," + ;
COMPANY+ "," +DEPT+ "," +ADDRESS+ "," + ;
ADDRESS2+ "," +CITY+ "," +;
ST+ "," +ZIP+ "," +PHONE+ "," +EXT+ "," +;
FAX+ "," +PAGENUM+ "," +;
CELLNUM+ "," +COUNTRY+ "," +EMAILER+ "," + ;
VERIFYFLAG+ "," + ACCEPTFLAG+ "," +VALIDFLAG+;
"," +RESIDEFLAG+ "," +CUSTOMID+ "," +;
REFERENCE+ "," +SERVTYEP+ "," +PACKCODE+ "," +'
COLLECTCOD+ "," +BILLCODE+ "," +ACCTNO+ "," + ;
DUTYBILL+ "," +DUTYBILL2+ "," +CURRENCY+ "," +;
INSIGHT+ "," +GROUNDREF+ "," +GROUNDS+ "," + ;
GROUNDS2+ "," +GROUNDS3+ "," +;
EXALERT+ "," +EXEMAIL+ "," +PARTNER+ "," + ;
NETRETURN+ "," +CUSTOMSID+ "," +;
ADDRESSYTP+ "," +F1+ "," +F2+ "," +F3+ "," + ;
F4+ "," +F5+ "," +F6+ "," +F7+;
"," +F8+ "," +F9+ "," +F10+ "," +F11+ "," +F12+;
"," +F13+ "," +F14+ "," +;
F15+ "," +F16+ "," +F17+ "," +F18+ "," +F19+ "," + ;
F20+ "," +F21+ "," +F22+;
"," +F23+ "," +F24+ "," +F25 + CHR(13)
ENDSCAN
=STRTOFILE(tString,"myText.txt")

OR

ERASE FILE "myFile.txt"
SELECT myTable
tString = ''
SCAN
tString = ;
NICKNAME+ "," +NAME+ "," +FIRST+ "," + ;
LAST+ "," +TITLE+ "," + ;
COMPANY+ "," +DEPT+ "," +ADDRESS+ "," + ;
ADDRESS2+ "," +CITY+ "," +;
ST+ "," +ZIP+ "," +PHONE+ "," +EXT+ "," +;
FAX+ "," +PAGENUM+ "," +;
CELLNUM+ "," +COUNTRY+ "," +EMAILER+ "," + ;
VERIFYFLAG+ "," + ACCEPTFLAG+ "," +VALIDFLAG+;
"," +RESIDEFLAG+ "," +CUSTOMID+ "," +;
REFERENCE+ "," +SERVTYEP+ "," +PACKCODE+ "," +'
COLLECTCOD+ "," +BILLCODE+ "," +ACCTNO+ "," + ;
DUTYBILL+ "," +DUTYBILL2+ "," +CURRENCY+ "," +;
INSIGHT+ "," +GROUNDREF+ "," +GROUNDS+ "," + ;
GROUNDS2+ "," +GROUNDS3+ "," +;
EXALERT+ "," +EXEMAIL+ "," +PARTNER+ "," + ;
NETRETURN+ "," +CUSTOMSID+ "," +;
ADDRESSYTP+ "," +F1+ "," +F2+ "," +F3+ "," + ;
F4+ "," +F5+ "," +F6+ "," +F7+;
"," +F8+ "," +F9+ "," +F10+ "," +F11+ "," +F12+;
"," +F13+ "," +F14+ "," +;
F15+ "," +F16+ "," +F17+ "," +F18+ "," +F19+ "," + ;
F20+ "," +F21+ "," +F22+;
"," +F23+ "," +F24+ "," +F25 + CHR(13)
=STRTOFILE(tString,"myText.txt",1)
ENDSCAN

which eever suits you. We could have the first written with the cumulative tString, but to be on safe side as to its size, I have made it progressive in the second suggestion.
:)

ramani :)
(Subramanian.G)
 
Would this be shorter?

Use MyTable
COPY TO test.csv DELIMITED

lnhandle= fopen("test.csv")
lnNewFile= fcreate("Output_test.csv")

do while not Feof(lnHandle)
lcString=fgets(lnHandle,2000)
= fput(lnNewFile,CHRTRAN(fgets(lnHandle,2000),CHR(34),""))
enddo
=fclose(lnHandle)
=fclose(lnNewFile
 
Please note I used fgets() twice by accident.

Use this code as a replacement for the last few lines instead:

do while not Feof(lnHandle)
= fput(lnNewFile,CHRTRAN(fgets(lnHandle,2000),CHR(34),""))
enddo
=fclose(lnHandle)
=fclose(lnNewFile)
 
Everyone.. thanks for your help. I have the program up and running and hope to never have to mess with it again.

You are all great!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top