Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void ImportDataFrom_Notepad(Args _args)
- {
- // #define.ioComma(",")
- // #define.ioEndLine("|")
- // #define.ioEndLine("\n")
- //
- // #define.ioRead("r")
- //
- #define.ioComma("|")
- // #define.ioEndLine("|")
- #define.ioEndLine("\n")
- #define.ioRead("r")
- TestNotepad TestNotepad;
- AsciiIo io ;
- str Name;
- str amount;
- str currencyCode;
- str transdate;
- int n = 1,idx =1;
- SysOperationProgress lprogress;
- #AviFiles
- ;
- io = new AsciiIo("C:\\Test\\28.txt", #ioRead); // This is the network path where the data file will be read from
- if(!io)
- error ("File cannot be open");
- lprogress = new SysOperationProgress();
- lprogress.setCaption("Insert From Notepad ");
- lprogress.setAnimation(#AviUpdate);
- if (io)
- {
- io.inFieldDelimiter(#ioComma);
- io.inRecordDelimiter(#ioEndLine);
- [Name,transdate, amount ,currencyCode] = io.read();
- while (io.status() == IO_Status::Ok)
- {
- if (io.status() != IO_Status::Ok)
- {
- error("File not found");
- }
- lprogress.setCount(n,Idx);
- lprogress.setText("Inserting trans");
- n++;
- Idx++;
- TestNotepad.Name = strltrim(Name);
- // TestNotepad.TransDate = mkdate( str2int( substr( transdate, 1, 2 ) ), str2int( substr( transdate, 3, 2 ) ), str2int( substr( transdate, 5, 4 ) ) );
- TestNotepad.TransDate = str2date(transdate,123);
- TestNotepad.Amount = str2num(amount);
- TestNotepad.CurrencyCode = currencyCode;
- TestNotepad.insert();
- [Name,transdate, amount ,currencyCode] = io.read();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement