I have been using the following code to try and import a text file into a specified table but when it comes to attaching strValue to the dthandle. setSource I come up against a problem because it does not recognise it. I think I'm very close to cracking this but it has now turned me into circles!!
Can anyone help?
method pushButton(var eventInfo Event)
var
dtHandle DataTransfer
lEditState Logical
tvTable TableView
fbiXfile FileBrowserInfo
loRetval Logical
strValue String
endvar
;initialise local vars
loRetval = TRUE
strValue = "IMPORT.TXT"
fbiXfile.Options = browseOptPathMustExit
fbiXfile.AllowableTypes = fbtext + fbfiles
fbiXfile.Alias = "artMan:"
fbiXfile.DefaultExt = "TXT"
loRetval = getFileName(strValue, fbiXfile)
if loRetval then
msginfo ("FYI", "You have chosen to import " + strvalue + "."
endif
;// Set notification for user
;//
setMouseShape(MOUSEWAIT, TRUE)
dtHandle.setSource (strValue) ;//PROBLEM AREA
dtHandle.setSourceCharSet(dtANSI)
;// Enable the key violation and problems tables
;//
dtHandle.setKeyViol(TRUE)
dtHandle.setProblems(TRUE)
;// The import does not start on line 1
;//
dtHandle.setSourceStartRow(2)
;// Setup delimited import options
;//
dtHandle.setSourceSeparator(","
dtHandle.setSourceDelimiter("\""
dtHandle.setSourceDelimitedFields(dtDELIMALLFIELDS)
;// We are always appending in this script since we force the
;// destination table to always exist
;//
dtHandle.setDest("artManartReport.DB"
dtHandle.setAppend(TRUE)
;// Reset cursor for the user
;//
setMouseShape(MOUSEARROW, TRUE)
;// Confirm the import
;//
if msgQuestion("Importing Data",
"You are about to import new contract data. Are you sure?" = "Yes" then
setMouseShape(MOUSEWAIT, TRUE)
;// Perform the import
;//
dtHandle.transferData()
;// Display table
;//
tvTable.open("artManartReport.DB"
else
setMouseShape(MOUSEARROW, TRUE)
endif
endMethod
Thanks,
Woody
Can anyone help?
method pushButton(var eventInfo Event)
var
dtHandle DataTransfer
lEditState Logical
tvTable TableView
fbiXfile FileBrowserInfo
loRetval Logical
strValue String
endvar
;initialise local vars
loRetval = TRUE
strValue = "IMPORT.TXT"
fbiXfile.Options = browseOptPathMustExit
fbiXfile.AllowableTypes = fbtext + fbfiles
fbiXfile.Alias = "artMan:"
fbiXfile.DefaultExt = "TXT"
loRetval = getFileName(strValue, fbiXfile)
if loRetval then
msginfo ("FYI", "You have chosen to import " + strvalue + "."
endif
;// Set notification for user
;//
setMouseShape(MOUSEWAIT, TRUE)
dtHandle.setSource (strValue) ;//PROBLEM AREA
dtHandle.setSourceCharSet(dtANSI)
;// Enable the key violation and problems tables
;//
dtHandle.setKeyViol(TRUE)
dtHandle.setProblems(TRUE)
;// The import does not start on line 1
;//
dtHandle.setSourceStartRow(2)
;// Setup delimited import options
;//
dtHandle.setSourceSeparator(","
dtHandle.setSourceDelimiter("\""
dtHandle.setSourceDelimitedFields(dtDELIMALLFIELDS)
;// We are always appending in this script since we force the
;// destination table to always exist
;//
dtHandle.setDest("artManartReport.DB"
dtHandle.setAppend(TRUE)
;// Reset cursor for the user
;//
setMouseShape(MOUSEARROW, TRUE)
;// Confirm the import
;//
if msgQuestion("Importing Data",
"You are about to import new contract data. Are you sure?" = "Yes" then
setMouseShape(MOUSEWAIT, TRUE)
;// Perform the import
;//
dtHandle.transferData()
;// Display table
;//
tvTable.open("artManartReport.DB"
else
setMouseShape(MOUSEARROW, TRUE)
endif
endMethod
Thanks,
Woody