montypython1
Technical User
Greetings,
I'm trying to import a file that is Pipe "|" delimited. This should be straight-forward, but I am getting a result that doesn't make sense to me.
My source data file looks like this:
02|BLDEALER|020000360|02|0000360|C|
02|BLDEALER|020000362|02|0000362|C|
02|BLDEALER|020000365|02|0000365|P|
02|BLDEALER|020000350|02|0000350|C|
02|BLDEALER|020000366|02|0000366|C|
My output (after importing) looks like this (with only the first field containing any data):
02|BL
02|BL
02|BL
02|BL
02|BL
My Code looks like this:
*==========================================================*
LOCAL lcFiles_Data, lcFileName_a, lcFileName_b
lcFiles_Data = "C:\ZZZ\Test"
lcFileName_a = "test.txt"
lcFileName_b = "test_b.csv"
lcFileName_c = "test_c.csv"
*
CREATE CURSOR automate_a ;
( ;
f01StoreNum c(05) , ;
f02Dealership c(10) , ;
f03DealNumLong c(9) , ;
f04Future01 c(2) , ;
f05DealNum c(7) , ;
f06Stat c(2) ;
)
IF FILE(lcFiles_Data + "\" + lcFileName_a) THEN
APPEND FROM lcFiles_Data + "\" + lcFileName_a DELIMITED WITH "|"
ELSE
WAIT WINDOW "missing file"
ENDIF
****************************************************************
1
Browse Normal NoCaption
COPY TO lcFiles_Data + "\" + lcFileName_c TYPE CSV
RETURN
*==========================================================*
It seems like it is ignoring the pipe character, even though I am using the format recommended in VFP help.
Interestingly, I can kinda sorta get close if I convert the file to CSV by replacing the pipe symbol using FILETOSTR, STRTRAN, and STRTOFILE, but this approach misses the leading and ending set of quotes (besides, I need to know how to import pipe delimited files anyway).
Does anyone have any suggestions of what I might be missing?
Thank you in advance.
Dave
I'm trying to import a file that is Pipe "|" delimited. This should be straight-forward, but I am getting a result that doesn't make sense to me.
My source data file looks like this:
02|BLDEALER|020000360|02|0000360|C|
02|BLDEALER|020000362|02|0000362|C|
02|BLDEALER|020000365|02|0000365|P|
02|BLDEALER|020000350|02|0000350|C|
02|BLDEALER|020000366|02|0000366|C|
My output (after importing) looks like this (with only the first field containing any data):
02|BL
02|BL
02|BL
02|BL
02|BL
My Code looks like this:
*==========================================================*
LOCAL lcFiles_Data, lcFileName_a, lcFileName_b
lcFiles_Data = "C:\ZZZ\Test"
lcFileName_a = "test.txt"
lcFileName_b = "test_b.csv"
lcFileName_c = "test_c.csv"
*
CREATE CURSOR automate_a ;
( ;
f01StoreNum c(05) , ;
f02Dealership c(10) , ;
f03DealNumLong c(9) , ;
f04Future01 c(2) , ;
f05DealNum c(7) , ;
f06Stat c(2) ;
)
IF FILE(lcFiles_Data + "\" + lcFileName_a) THEN
APPEND FROM lcFiles_Data + "\" + lcFileName_a DELIMITED WITH "|"
ELSE
WAIT WINDOW "missing file"
ENDIF
****************************************************************
1
Browse Normal NoCaption
COPY TO lcFiles_Data + "\" + lcFileName_c TYPE CSV
RETURN
*==========================================================*
It seems like it is ignoring the pipe character, even though I am using the format recommended in VFP help.
Interestingly, I can kinda sorta get close if I convert the file to CSV by replacing the pipe symbol using FILETOSTR, STRTRAN, and STRTOFILE, but this approach misses the leading and ending set of quotes (besides, I need to know how to import pipe delimited files anyway).
Does anyone have any suggestions of what I might be missing?
Thank you in advance.
Dave