Create Text File

Create Text File

Postby Colin Haig » Fri Apr 11, 2008 12:45 am

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
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Postby yury » Fri Apr 11, 2008 1:09 am

hello,

you can create txt files using the class TTxtfile:

Code: Select all  Expand view  RUN
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
yury
 
Posts: 56
Joined: Wed May 23, 2007 2:01 pm

Re: Create Text File

Postby mmercado » Fri Apr 11, 2008 1:13 am

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  Expand view  RUN
cText := ""

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

MemoWrit( "MyText.txt", cText )


I hope have been helpfull

Regards

Manuel Mercado
User avatar
mmercado
 
Posts: 782
Joined: Wed Dec 19, 2007 7:50 am
Location: Salamanca, Gto., México

Create Text File

Postby Colin Haig » Fri Apr 11, 2008 2:38 am

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

Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 43 guests