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

Append From Delimited with ; 2

Status
Not open for further replies.

GKatReliable

Programmer
Jul 2, 2002
45
US
I have to APPEND FROM a text file delimited with semicolons.
When I say APPEND FROM ... DELIMITED WITH ;
or DELIMITED WITH ";"
or DELIMITED WITH SEMICOLON
or DELIMITED WITH CHR(59)
I just get Unrecognized phrase/keyword in command.
What is the syntax for a non-standard delimiter?
Regards,
Glenn Koproske
 
Try this

APPEND DELIMITED WITH ; FROM filename

the delimiter is not character data, so no quotes,etc. and if you put it at the end of the command, Foxpro thinks that it is a line continuation command

John
 
This was an excellent solution to my command line problem, that putting ; at the end confused FoxPro 2.6. The APPEND FROM command now executes without error...
However...darn it, there is a however.
Only the first field is filled in on each record, meaning that Fox doesn't know what to do once it hits the first semicolon in each record in the actual file. I tried substituting CHR(59) in the command, but that didn't work.
It doesn't seem to want to parse the file now.
Regards,
Glenn Koproske
 
Glenn,
"delimited with" are only delimiters for characters field,
allowing use standard delimiter "," inside. Your
field1;field2;...is for append only first field -
it search "," to begin load second field.
Try
field1,;test1,test2;,...then in field2 is "test1,test2"
Tesar
 
Write a program (using low level functions to open, read and write) that converts every ';' into a ',' as field separator.

Then append from will work without any problems.

Rob.
 
A sample to do so with low level functions could be:
Rob.


* convert a specific character in a txtfile....
close all
clear
STORE FOPEN('filein.txt') TO file_in && Open the file
STORE FSEEK(file_in, 0) TO ifp_top && Move pointer to BOF
file_out = 'fileout.txt'
handle = FCREATE(file_out) && Open output file
do while !feof(file_in)
cIn=fgets(file_in)
cOut=strtran(cIn,';',',')
=fputs(handle,cOut)
enddo
= FCLOSE(file_in)
= FCLOSE(handle)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top