seancaddell
asked on
Schema File to import ASCII table into TTable component in Delphi 6 not working correctly.
Hi Experts,
I am using the following schema file to populate a TTable with the data in ascii file 'test2.txt", the first three fields are imported. The third field contains extraneous characters unless the data is the full length of the field definition. no more data from the record is displayed.
I am under the impression that the ascii file needs to be fixed width in this scenario, is this true? Is there an error in my schema definition?
Also when I define the float fields does the length include the decimal point?
If I make the text file fixed width will it help me at all?
I need help with this urgently so 500 points up for grabs
[test2]
Filetype=VARYING
Delimiter="
Separator=,
CharSet=ascii
Field1=Number1,number,3,00 ,00
Field2=Number2,number,4,00 ,03
Field3=Desc,Char,12,00,07
Field4=Number3,number,2,00 ,19
Field5=Number4,number,2,00 ,21
Field6=Number5,float,6,2,2 3
Field7=Number6,float,6,2,2 9
TEST2.TXT
900,3820,"Dive kayak”,24,16,1356.75,3999. 95
900,3820,"Dive kayak2”,24,16,1356.75,3999 .95
900,3820,"Dive kayak24”,24,16,1356.75,399 9.95
900,3820,"Dive kayak”,24,16,1356.75,3999. 95
900,3820,"Dive kayak”,24,16,1356.75,3999. 95
900,3820,"Dive kayak”,24,16,1356.75,3999. 95
900,3820,"Dive kayak”,24,16,1356.75,3999. 95
900,3820,"Dive kayak”,24,16,1356.75,3999. 95
900,3820,"Dive kayak”,24,16,1356.75,3999. 95
900,3820,"Dive kayak”,24,16,1356.75,3999. 95
900,3820,"Dive kayak”,24,16,1356.75,3999. 95
900,3820,"Dive kayak”,24,16,1356.75,3999. 95
900,3820,"Dive kayak”,24,16,1356.75,3999. 95
I am using the following schema file to populate a TTable with the data in ascii file 'test2.txt", the first three fields are imported. The third field contains extraneous characters unless the data is the full length of the field definition. no more data from the record is displayed.
I am under the impression that the ascii file needs to be fixed width in this scenario, is this true? Is there an error in my schema definition?
Also when I define the float fields does the length include the decimal point?
If I make the text file fixed width will it help me at all?
I need help with this urgently so 500 points up for grabs
[test2]
Filetype=VARYING
Delimiter="
Separator=,
CharSet=ascii
Field1=Number1,number,3,00
Field2=Number2,number,4,00
Field3=Desc,Char,12,00,07
Field4=Number3,number,2,00
Field5=Number4,number,2,00
Field6=Number5,float,6,2,2
Field7=Number6,float,6,2,2
TEST2.TXT
900,3820,"Dive kayak”,24,16,1356.75,3999.
900,3820,"Dive kayak2”,24,16,1356.75,3999
900,3820,"Dive kayak24”,24,16,1356.75,399
900,3820,"Dive kayak”,24,16,1356.75,3999.
900,3820,"Dive kayak”,24,16,1356.75,3999.
900,3820,"Dive kayak”,24,16,1356.75,3999.
900,3820,"Dive kayak”,24,16,1356.75,3999.
900,3820,"Dive kayak”,24,16,1356.75,3999.
900,3820,"Dive kayak”,24,16,1356.75,3999.
900,3820,"Dive kayak”,24,16,1356.75,3999.
900,3820,"Dive kayak”,24,16,1356.75,3999.
900,3820,"Dive kayak”,24,16,1356.75,3999.
900,3820,"Dive kayak”,24,16,1356.75,3999.
ASKER
OK,
I have tested this on a blank form with only TTable, TDatasource and DBGrid, only the first three fields appear. If I modify the layout of my data as follows then all the fields are displayed although the last field again contains extraneous data.
900,3820,24,16,1356.75,399 9.95,"Dive kayak”
900,3820,24,16,1356.75,399 9.95,"Dive kayak2”
900,3820,24,16,1356.75,399 9.95,"Dive kayak24”
900,3820,24,16,1356.75,399 9.95,"Dive kayak”
900,3820,24,16,1356.75,399 9.95,"Dive kayak”
900,3820,24,16,1356.75,399 9.95,"Dive kayak”
900,3820,24,16,1356.75,399 9.95,"Dive kayak”
900,3820,24,16,1356.75,399 9.95,"Dive kayak”
900,3820,24,16,1356.75,399 9.95,"Dive kayak”
900,3820,24,16,1356.75,399 9.95,"Dive kayak”
The problems seems to be with the char field, if I add another char field after Desc called Desc1 no data for this field is displayed.
[test2]
Filetype=VARYING
Delimiter="
Separator=,
CharSet=ascii
Field1=Number1,number,3,0, 0
Field2=Number2,number,4,0, 3
Field3=Number3,number,2,0, 7
Field4=Number4,number,2,0, 9
Field5=Number5,float,7,2,1 1
Field6=Number6,float,7,0,1 8
Field7=Desc,Char,12,0,25
Field8=Desc1,Char,12,0,37
DATA
900,3820,24,16,1356.75,399 9.95,"Dive kayak”,"SMALL DINGY"
900,3820,24,16,1356.75,399 9.95,"Dive kayak2”,"SMALL DINGY"
900,3820,24,16,1356.75,399 9.95,"Dive kayak24”,"SMALL DINGY"
900,3820,24,16,1356.75,399 9.95,"Dive kayak”,"SMALL DINGY"
900,3820,24,16,1356.75,399 9.95,"Dive kayak”,"SMALL DINGY"
900,3820,24,16,1356.75,399 9.95,"Dive kayak”,"SMALL DINGY"
900,3820,24,16,1356.75,399 9.95,"Dive kayak”,"SMALL DINGY"
900,3820,24,16,1356.75,399 9.95,"Dive kayak”,"SMALL DINGY"
900,3820,24,16,1356.75,399 9.95,"Dive kayak”,"SMALL DINGY"
900,3820,24,16,1356.75,399 9.95,"Dive kayak”,"SMALL DINGY"
500 points to the solution provider.
I have tested this on a blank form with only TTable, TDatasource and DBGrid, only the first three fields appear. If I modify the layout of my data as follows then all the fields are displayed although the last field again contains extraneous data.
900,3820,24,16,1356.75,399
900,3820,24,16,1356.75,399
900,3820,24,16,1356.75,399
900,3820,24,16,1356.75,399
900,3820,24,16,1356.75,399
900,3820,24,16,1356.75,399
900,3820,24,16,1356.75,399
900,3820,24,16,1356.75,399
900,3820,24,16,1356.75,399
900,3820,24,16,1356.75,399
The problems seems to be with the char field, if I add another char field after Desc called Desc1 no data for this field is displayed.
[test2]
Filetype=VARYING
Delimiter="
Separator=,
CharSet=ascii
Field1=Number1,number,3,0,
Field2=Number2,number,4,0,
Field3=Number3,number,2,0,
Field4=Number4,number,2,0,
Field5=Number5,float,7,2,1
Field6=Number6,float,7,0,1
Field7=Desc,Char,12,0,25
Field8=Desc1,Char,12,0,37
DATA
900,3820,24,16,1356.75,399
900,3820,24,16,1356.75,399
900,3820,24,16,1356.75,399
900,3820,24,16,1356.75,399
900,3820,24,16,1356.75,399
900,3820,24,16,1356.75,399
900,3820,24,16,1356.75,399
900,3820,24,16,1356.75,399
900,3820,24,16,1356.75,399
900,3820,24,16,1356.75,399
500 points to the solution provider.
this quote: ”
is not this quote: "
look sharp
replace it, and it works perfect
meikl ;-)
is not this quote: "
look sharp
replace it, and it works perfect
meikl ;-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Well spotted, I take my hat off to you, you've been a great help, I'll be calling on you again sometime............
Just wondering how on earth you imported a CSV into a TTable anyway? I'm trying to do this myself.
ASKER
Have a look at all the questions I have asked (there are only three), I started out wanting to import text into a table but this took a very long time, my ultimate aim was to get the text file into access and have successfully done that and it's very quick. You will hve to use a shema file to import ascii files into Ttables, there is plenty of info at experts regarding this.
>width in this scenario, is this true?
no, its a varying content
>Is there an error in my schema definition?
seems not so
>Also when I define the float fields does the length include the
>decimal point?
should be included
>If I make the text file fixed width will it help me at all?
no
sorry can't test it myself yet,
but it looks proper
meikl ;-)