
On my test machine this conversion took about 8 seconds. Ibec_Pause(1000) -when working in ibexpert, the result stays for 1 second on the line above the sql editorĪfter the script is loaded in the SQL Editor, execute it by pressing. Ibec_Progress('finished in '||TotalTime||' ms') -display the required time Ibec_fs_CloseFile(RawData) -after loop has ended, close input and output file If (ibec_mod(i,1000)=0) then ibec_Progress(I) -every 1000 operations send a message to the screen Ibec_fs_Writeln(FixedData,line) -write this new line to the output file Line=ID+CATEGORY_ID+TITLE+ACTOR+PRICE+SPECIAL -combine the columns with spaces, but without delimiter

ID= ibec_Copy(Vals+' ',1,18) -we know that we get 6 columns and all must be filled with spacesĬATEGORY_ID= ibec_Copy(Vals+' ',1,18) ValCount = ibec_ParseCSVLine(Vals, s, '', ' ', _csvEmptyStringAsNull) -copy data to an array S = ibec_fs_Readln(RawData) -read next line While (not ibec_fs_Eof(RawData)) do -now start the loop for all lines in input S = ibec_fs_Readln(RawData) -read the first line to step over the captions all is fine, now we start the processing Ibec_fs_CloseFile(FixedData) -close and write the empty fileįixedData = ibec_fs_OpenFile('D:\IBEImportExport_Tutorial\FIXEDFORMATDATA.TXT', _fmOpenWrite) create a filehandle for the output file, create an empty fileįixedData = ibec_fs_OpenFile('D:\IBEImportExport_Tutorial\FIXEDFORMATDATA.TXT', _fmCreate) RawData = ibec_fs_OpenFile('D:\IBEImportExport_Tutorial\RawData.csv', _fmOpenRead) create a filehandle for the input file, in this case the CSV file, that we want to import

Then ibec_DeleteFile('D:\IBEImportExport_Tutorial\FIXEDFORMATDATA.TXT')

If (ibec_FileExists('D:\IBEImportExport_Tutorial\FIXEDFORMATDATA.TXT')) delete the Fixedformat file if it exists StartTime=ibec_GetTickCount() -remember the starting time Declare the variables, in ibeblock this is optional, but sometimes useful
