Create Text File

Post Reply
Colin Haig
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Create Text File

Post by Colin Haig »

Hi All

I have to create a text file to send data to a bank - I created a database
with one field - I build each line in the databases and then use copy to
SDF with no delimiters but when the file is created it has an end of line
marker - when the file is imported to the bank it fails because of the end of line marker - can anyone suggest another way to do this.

Regards

Colin
yury
Posts: 56
Joined: Wed May 23, 2007 2:01 pm

Post by yury »

hello,

you can create txt files using the class TTxtfile:

Code: Select all

cFile = 'MyOrder.txt'


oFile = TTxtFile():New( cFile )


select mBD
go top


while .not.eof()
   cLine = ''
   
    for ii=1 to fcount()
        cLine+=fieldget(ii)
    next
  
   oFile:Add( cLine )
   skip +1
enddo


oFile:Close()


return 
regards
Yury Marcelino Al
yury030575@yahoo.com.br
vimansca@vimansca.com.br
Leme / SP - Brasil
User avatar
mmercado
Posts: 782
Joined: Wed Dec 19, 2007 7:50 am
Location: Salamanca, Gto., México

Re: Create Text File

Post by mmercado »

Colin Haig wrote:I have to create a text file to send data to a bank - I created a database
with one field - I build each line in the databases and then use copy to
SDF with no delimiters but when the file is created it has an end of line
marker - when the file is imported to the bank it fails because of the end of line marker - can anyone suggest another way to do this.
Hi Colin:

The same way you fill the record field, you may fill a cLine character variable, then add it to a cText next way:

Code: Select all

cText := ""

For nI := 1 To nTotalLines
   cLine := cYourTextLine
   cText += cLine + CRLF
Next

MemoWrit( "MyText.txt", cText )
I hope have been helpfull

Regards

Manuel Mercado
Colin Haig
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Create Text File

Post by Colin Haig »

Thanks Yuri and Manual for your quick replies - I used the TTxtFile Class
and everything worked fine.

Regards

Colin
Post Reply