Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 2 of 2 total |
ImportTable issues |
Thu, Mar 6 2014 4:32 PM | Permanent Link |
Gerald J. Clancy, Jr. | Problem: ImportTable seems to be treating commas within fields/columns
enclosed in double quotes as delimiters and truncating the value of the field. I have a text file whose first three records look like this: "Bill","Full_Name","Session_Date","CurrentStatus","Abstract","Action","Legislator_Vote" "S322 ","Addiego, Dawn Marie","02/27/2014","2RA","Nursing, nonpub. sch.-incl. presch pupil","3RDG FINAL PASSAGE","Y" "S322 ","Allen, Diane B.","02/27/2014","2RA","Nursing, nonpub. sch.-incl. presch pupil","3RDG FINAL PASSAGE","Y" The first record is the column headers. Here's the relevant code: with DMNJ.aptStVotes do begin { this table is used generically } if Active then Close else ; DatabaseName := cNJPath; TableName := sFileStem + 'Vot'; Exclusive := True; if Exists then begin Open; EmptyTable; with IncomingFields do begin Add('Bill'); Add('Full_Name'); Add('Session_Date'); Add('CurrentStatus'); Add('Abstract'); Add('Action'); Add('Legislator_Vote'); end; //with try ImportTable(sFullFileName, ',', False, IncomingFields); {, 'mm/dd/yyyy'} except on E: Exception do begin ShowMessage('Error importing ' + DMNJ.aptStVotes.TableName + ': ' + E.Message); IncomingFields.Free; Exit; end; end; end else ; ... Note that the delimiter parameter is a comma. What is happening is ImportTable terminates the field when it sees a comma in the Abstract field. So, "Nursing, nonpub. sch.-incl. presch pupil" is for some reason being imported as "Nursing, n". (The target table field for Abstract is 60 chars.) What am I missing? Jerry |
Thu, Mar 6 2014 4:34 PM | Permanent Link |
Gerald J. Clancy, Jr. | IGNORE THIS.
I lied. Just double checked and he table field is defined as only 10 characters and, guess what, that's exactly what I'm getting. My bad. Jerry "Jerry Clancy" <jclancy@billtrak.com> wrote in message news:B39E1EF0-9E56-4AEE-8D06-27A03A533B89@news.elevatesoft.com... > Problem: ImportTable seems to be treating commas within fields/columns > enclosed in double quotes as delimiters and truncating the value of the > field. > > I have a text file whose first three records look like this: > > "Bill","Full_Name","Session_Date","CurrentStatus","Abstract","Action","Legislator_Vote" > "S322 ","Addiego, Dawn Marie","02/27/2014","2RA","Nursing, nonpub. > sch.-incl. presch pupil","3RDG FINAL PASSAGE","Y" > "S322 ","Allen, Diane B.","02/27/2014","2RA","Nursing, nonpub. > sch.-incl. presch pupil","3RDG FINAL PASSAGE","Y" > > The first record is the column headers. > > Here's the relevant code: > > with DMNJ.aptStVotes do begin { this table is used > generically } > if Active then Close else ; > DatabaseName := cNJPath; > TableName := sFileStem + 'Vot'; > Exclusive := True; > if Exists then begin > Open; > EmptyTable; > with IncomingFields do begin > Add('Bill'); > Add('Full_Name'); > Add('Session_Date'); > Add('CurrentStatus'); > Add('Abstract'); > Add('Action'); > Add('Legislator_Vote'); > end; //with > try > ImportTable(sFullFileName, ',', False, IncomingFields); {, > 'mm/dd/yyyy'} > except > on E: Exception do begin > ShowMessage('Error importing ' + DMNJ.aptStVotes.TableName + ': > ' + E.Message); > IncomingFields.Free; > Exit; > end; > end; > end else ; > ... > > Note that the delimiter parameter is a comma. What is happening is > ImportTable terminates the field when it sees a comma in the Abstract > field. So, "Nursing, nonpub. sch.-incl. presch pupil" is for some reason > being imported as "Nursing, n". (The target table field for Abstract is 60 > chars.) > > What am I missing? > > Jerry > > |
This web page was last updated on Wednesday, April 24, 2024 at 11:07 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |