Joel
Script for importing data February 25, 2009 06:18PM |
DarrenF
Re: Script for importing data February 26, 2009 02:29AM |
IDXLSFile is int iNo_rows is int glocaliIResult is int // Open the Currencies excel file IDXLSFile = xlsOpen("c:\My Projects\InterPoint\Extract Files for Import\currencies.xls") // If the Excel file was found, then carry on processing // ELSE // Report an error IF IDXLSFile <> -1 THEN // Get number of rows in the Excel file iNo_rows = xlsNbRow(IDXLSFile) // Test for existence of Country table IF NOT HOpen(Country,hOReadWrite) THEN Error("Unable to locate the required Country database table!") RETURN END // HCreation will delete and re-create these tables and also reset all the rec no's and auto IDs HCreation(Country) // Process each row of the Excel file // Start at row 2 to ignore the Excel title row... FOR glocaliNV_Row = 2 TO iNo_rows // Country Details Country.cCountryCode = xlsData(IDXLSFile,glocaliNV_Row,1) Country.cCountryName = xlsData(IDXLSFile,glocaliNV_Row,5) Country.cCurrencyCode = xlsData(IDXLSFile,glocaliNV_Row,2) Country.nCurrencyCode = xlsData(IDXLSFile,glocaliNV_Row,3) Country.cCurrencyDesc = xlsData(IDXLSFile,glocaliNV_Row,4) Country.bActiveCountry = xlsData(IDXLSFile,glocaliNV_Row,6) Country.bActiveCurrency = xlsData(IDXLSFile,glocaliNV_Row,7) Country.cCurrencySymbol = "" Country.dtCreated = DateSys + TimeSys Country.cNotes = "Auto loaded from ISO import file on " + DateToString(DateSys()) // Write the data to the database HAdd(Country) END // Close XLS file xlsClose(IDXLSFile) ELSE Info(xlsMsgError(IDXLSFile)) END
Joel
Re: Script for importing data February 26, 2009 05:03PM |
Hans60
Re: Script for importing data February 28, 2009 02:38PM |