>************************************************************************************************ >PROCEDURE ProcessFoxPro() > >* Store the Table name and Location into variables which we will use later on. >ExportFileLocation = ADDBS(ALLTRIM(Systems2Process.ExportDataLocation)) >ExportFileName = ALLTRIM(Systems2Process.ExportDataName) > >FieldList = "" >ValuesList = " VALUES(" >RunCommand = "INSERT INTO " + ExportFileLocation + ExportFileName + "(" > >* STRTOFILE("Started ProcessFoxPro", "c:\junk\InsertCommand.txt", 1) > >This.GetSystemLayoutLocal(Systems2Process.SystemIdPk) > >SELECT SystemLayout > >SCAN > > FieldList = FieldList + ALLTRIM(SystemLayout.SystemFieldName) + "," > > Field2Process = ALLTRIM("Data2Add." + MasterFieldName) > TempVal = TRANSFORM(&Field2Process) > > InsertFieldName = ExportFileName + "." + ALLTRIM(SystemLayout.SystemFieldName) > > * This is the line that does not return the correct value. > InsertFieldType = TYPE(InsertFieldName) > > STRTOFILE(InsertFieldName + SPACE(5) + InsertFieldType + CHR(13), "c:\junk\InsertCommand.txt", 1) > > DO CASE > CASE InsertFieldType = "D" > TempVal = "{" + TempVal + "}" > CASE InsertFieldType = "T" > TempVal = "{" + TempVal + "}" > CASE InsertFieldType = "C" > TempVal = "'" + ALLTRIM(TempVal) + "'" > CASE InsertFieldType = "M" > TempVal = "'" + ALLTRIM(TempVal) + "'" > CASE InsertFieldType = "N" > TempVal = TempVal > OTHERWISE > TempVal = "'" + ALLTRIM(TempVal) + "'" > ENDCASE > > ValuesList = ValuesList + TempVal + "," > >ENDSCAN > >* Strip the ending ; off the pieces of the insert command and then add the necessary ) instead. >FieldList = SUBSTR(FieldList, 1, LEN(FieldList) -1) + ")" >ValuesList = SUBSTR(ValuesList, 1, LEN(ValuesList) - 1) + ")" > >* Build the FINAL Insert command so that we can return it. >RunCommand = RunCommand + FieldList + ValuesList > >RETURN (RunCommand)