Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#Define xlLastCell 11
Create Cursor Import(....fields as needed for the csv...)
WITH oExcel.ActiveWorkBook.ActiveSheet
loLastCell = .Cells.SpecialCells( xlLastCell )
laData = .Range( .Cells(2,1), m.loLastCell ).Value && NOTE: asusmes data starts in row 2, row 1 just has the captions.
ENDWITH
Insert into Import From Array laData
Select *,;
LEFT(variabletext1,254) As v11, ;
LEFT(Substr(variabletext1,255,254),254) As v12, ;
LEFT(variabletext2,254) As v21, ;
LEFT(Substr(variabletext2,255,254),254) As v22, ;
LEFT(variabletext3,254) As v31, ;
LEFT(Substr(variabletext3,255,254),254) As v32, ;
LEFT(variabletext4,254) As v41, ;
LEFT(Substr(variabletext4,255,254),254) As v42 ;
FROM tempcsv ;
INTO Table mytest
LOCAL CSVP AS CSVP_AllVarchar
m.CSVP = CREATEOBJECT("CSVP_AllVarchar")
? m.CSVP.Import(GETFILE(), "tmpCSV")
DEFINE CLASS CSVP_AllVarchar AS CSVProcessor
FUNCTION ScanNumber (Source AS String) AS Number
RETURN .NULL.
ENDFUNC
FUNCTION ScanLogical (Source AS String) AS Boolean
RETURN .NULL.
ENDFUNC
FUNCTION ScanDate (Source AS String, IsTime AS Boolean, UseRegularExpression AS Logical) AS DateOrDatetime
RETURN .NULL.
ENDFUNC
FUNCTION ScanBinary (Source AS String) AS Blob
RETURN .NULL.
ENDFUNC
ENDDEFINE
linousa said:Not sure how to call table designer on cursor, so I save to free table(copy to).
DEFINE CLASS CSVP_AllVarchar AS CSVProcessor
FUNCTION ScanNumber (Source AS String) AS Number
RETURN .NULL.
ENDFUNC
FUNCTION ScanLogical (Source AS String) AS Boolean
RETURN .NULL.
ENDFUNC
FUNCTION ScanDate (Source AS String, IsTime AS Boolean, UseRegularExpression AS Logical) AS DateOrDatetime
RETURN .NULL.
ENDFUNC
FUNCTION ScanBinary (Source AS String) AS Blob
RETURN .NULL.
ENDFUNC
ENDDEFINE
Do 'csvp.prg'
LOCAL CSVP AS CSVP_AllVarchar
m.CSVP = CREATEOBJECT("CSVP_AllVarchar")
If m.CSVP.Import(GETFILE(), "tmpCSV") = 0
Select tempCSV
* BROWSE
Else
* an error occurred
ENDIF
Linousa said:Will it be hard to add field overflow feature to CSVProcessor?