mibuso.com

Microsoft Business Solutions online community
It is currently Tue May 21, 2013 6:27 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Importing from Text File
PostPosted: Thu Dec 08, 2011 11:04 am 
Offline

Joined: Thu Feb 18, 2010 11:21 am
Posts: 197
Country: Belgium (be)
bekio wrote:
And in the last line you don't have to use copystr, but instead just copy the value of field:

TestImport.Address:=FORMAT(vString);


Top
 Profile E-mail  
 
 Post subject: Re: Importing from Text File
PostPosted: Thu Dec 08, 2011 11:25 am 
Offline

Joined: Wed Sep 29, 2010 3:18 am
Posts: 764
Country: Australia (au)
bekio wrote:
bekio wrote:
And in the last line you don't have to use copystr, but instead just copy the value of field:

TestImport.Address:=FORMAT(vString);

Data :
Quote:
test code1;test name1;test address1
test code2;test name2;test address2
test code3;test name3;test address3


Code :
Code: Select all
SFile.TEXTMODE(TRUE);
SFile.WRITEMODE(FALSE);
SFile.OPEN('D:\TestImport\Test.txt');
REPEAT
SFile.READ(vString);
PosCode:=STRPOS(vString,';');
TestImport.No := FORMAT(COPYSTR(vString,1,PosCode-1));
vString:=DELSTR(vString,PosCode,1);

PosCode:=STRPOS(vString,';');
TestImport.Name := FORMAT(COPYSTR(vString,1,PosCode-1));
vString:=DELSTR(vString,PosCode,1);

//PosCode:=STRPOS(vString,';');
//TestImport.Address := FORMAT(COPYSTR(vString,1,PosCode-1));
TestImport.Address := FORMAT(vString);
//vString:=DELSTR(vString,PosCode,1);

TestImport.INSERT;
UNTIL
SFile.POS = SFile.LEN;
MESSAGE('Import Done');


New error


Attachments:
new error.jpg
new error.jpg [ 20.93 KiB | Viewed 162 times ]
Top
 Profile E-mail  
 
 Post subject: Re: Importing from Text File
PostPosted: Thu Dec 08, 2011 11:41 am 
Offline

Joined: Thu Feb 18, 2010 11:21 am
Posts: 197
Country: Belgium (be)
My mistake,

just use:
String:=DELSTR(vString,1,PosCode);
instead of
String:=DELSTR(vString,PosCode,1);
#-o


Top
 Profile E-mail  
 
 Post subject: Re: Importing from Text File
PostPosted: Thu Dec 08, 2011 11:45 am 
Offline

Joined: Wed Sep 29, 2010 3:18 am
Posts: 764
Country: Australia (au)
bekio wrote:
My mistake,

just use:
String:=DELSTR(vString,1,PosCode);
instead of
String:=DELSTR(vString,PosCode,1);
#-o


hi bekio
now it works
thanks a lot for your help
the final code is like this
Code: Select all

SFile.TEXTMODE(TRUE);
SFile.WRITEMODE(FALSE);
SFile.OPEN('D:\TestImport\Test.txt');
REPEAT
SFile.READ(vString);
PosCode:=STRPOS(vString,';');
TestImport.No := FORMAT(COPYSTR(vString,1,PosCode-1));
vString:=DELSTR(vString,1,PosCode);

PosCode:=STRPOS(vString,';');
TestImport.Name := FORMAT(COPYSTR(vString,1,PosCode-1));
vString:=DELSTR(vString,1,PosCode);

TestImport.Address := FORMAT(vString);

TestImport.INSERT;
UNTIL
SFile.POS = SFile.LEN;
MESSAGE('Import Done');


Top
 Profile E-mail  
 
 Post subject: Re: Importing from Text File
PostPosted: Thu Dec 08, 2011 11:49 am 
Offline

Joined: Thu Feb 18, 2010 11:21 am
Posts: 197
Country: Belgium (be)
You are welcome,

Glad to help you,

:D


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: