Alaska Software Inc. - Import SDF file
Username: Password:
AuthorTopic: Import SDF file
Carlos A Beling Import SDF file
on Fri, 03 Jul 2020 19:50:53 -0300
Hi Good night.
Please, what is wrong with this importation of SDF file in a compatible 
way to Clipper?
The SDF.prg is a wrapper for the Xbase++ functions used for import SDF.
The CRLF is ignored as end of line and it is been created a file with 
SDF extension in Xbase++ format.

Fraternally
Beling


Import.zip
Andreas Gehrs-Pahl
Re: Import SDF file
on Sat, 04 Jul 2020 15:19:37 -0400
Carlos,

>Please, what is wrong with this importation of SDF file in a compatible 
>way to Clipper?

The SDFDBE and the SDF clause for Append From require records (lines) to be 
all the same length. Your file has variable length records/lines, though.

>The SDF.prg is a wrapper for the Xbase++ functions used for import SDF.
>The CRLF is ignored as end of line and it is been created a file with 
>SDF extension in Xbase++ format.

You don't need the DbeSys.prg or the SDF.prg in your Project.xpj for your 
program to work. The DbeSys.prg is the default program and nothing in the 
SDF.prg is used. Also, MemoEdit() in line 30 will cause a runtime error.

Instead, just use the following:

Append From 'Classes.txt' Delimited

(instead of SDF) and everything should work just fine.

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[L]:   https://www.LinkedIn.com/in/AndreasGehrsPahl
[F]:   https://www.FaceBook.com/AbsoluteSoftwareLLC
Andreas Gehrs-Pahl
Re: Import SDF file
on Sat, 04 Jul 2020 15:28:53 -0400
Carlos,

One more thing. Because the last line in your file doesn't end with a CRLF, 
that last line/record isn't appended. So, before doing your Append, open the 
file and check if it ends with CRLF, and if not, simply add it.

If you don't want to fix the input file, you will have to write your own 
append code, as Append From -- or the _dbImport() function, which is defined  
in the DbBulk.prg file -- won't be able to append all the "records" without 
some changes.

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[L]:   https://www.LinkedIn.com/in/AndreasGehrsPahl
[F]:   https://www.FaceBook.com/AbsoluteSoftwareLLC
Carlos A Beling Re: Import SDF file
on Sat, 04 Jul 2020 20:05:21 -0300
HI Andreas.
Good night.
Many thanks again. That's all that I can say.
As the lines are of variable length I inserted in each one line an 
unuseful char for to make each one as delimited by that char and for to 
be able for to import the file as delimited.

Fraternally
Beling

On 04/07/2020 16:28, Andreas Gehrs-Pahl wrote:
> Carlos,
> 
> One more thing. Because the last line in your file doesn't end with a CRLF,
> that last line/record isn't appended. So, before doing your Append, open the
> file and check if it ends with CRLF, and if not, simply add it.
> 
> If you don't want to fix the input file, you will have to write your own
> append code, as Append From -- or the _dbImport() function, which is defined
> in the DbBulk.prg file -- won't be able to append all the "records" without
> some changes.
> 
> Hope that helps,
> 
> Andreas
>
Andreas Gehrs-Pahl
Re: Import SDF file
on Sun, 05 Jul 2020 15:20:10 -0400
Carlos,

>As the lines are of variable length I inserted in each one line an 
>unuseful char for to make each one as delimited by that char and for to 
>be able for to import the file as delimited.

If the input file has only one field per line/record -- as in your example 
file "Classes.txt" -- then there is no need to insert any delimiter 
characters!

Only the CRLF at the end of each line, including the last one, is required. 
To remove the first, empty, record, you could also remove the leading CRLF 
in that file.

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[L]:   https://www.LinkedIn.com/in/AndreasGehrsPahl
[F]:   https://www.FaceBook.com/AbsoluteSoftwareLLC
Carlos A Beling Re: Import SDF file
on Wed, 08 Jul 2020 10:58:39 -0300
Hello Andreas.
Good day.
Many thanks.
Everything is working fine.

Fraternally
Beling

On 05/07/2020 16:20, Andreas Gehrs-Pahl wrote:
> Carlos,
> 
>> As the lines are of variable length I inserted in each one line an
>> unuseful char for to make each one as delimited by that char and for to
>> be able for to import the file as delimited.
> 
> If the input file has only one field per line/record -- as in your example
> file "Classes.txt" -- then there is no need to insert any delimiter
> characters!
> 
> Only the CRLF at the end of each line, including the last one, is required.
> To remove the first, empty, record, you could also remove the leading CRLF
> in that file.
> 
> Hope that helps,
> 
> Andreas
>