<< Click to Display Table of Contents >> Navigation: Apollo API Listing > sx_AppendFrom |
Declare Function sx_AppendFrom Lib "Apollo9.dll"
(ByVal cpFileName As String,
ByVal iSourceType As Integer,
ByVal cpForExpr As Any)
As Integer
BOOL FAR PASCAL sx_AppendFrom
(BYTEP cpFileName,
SHORT iSourceType,
BYTEP cpForExpr);
Appends data from a source table to the current table. All fields with matching names and types are appended to the current table. If field length differs, data in the destination table is either truncated or padded with spaces.
Deleted records in the source file are not appended to the target table.
Speed Tip: If a structural (AKA 'production') index exists for the source table, rename it before calling sx_AppendFrom. The operation takes less time to complete if the source and target tables are in natural order with no open indexes. For any open non-structural index files use sx_CloseIndexes on the target (current) table and reopen and reindex after appending.
Note: If a production index exists for the source database, and the index expression(s) contain alias name references, xBase evaluation errors will occur because Apollo assigns an internal alias name to the source database when it is opened in sx_AppendFrom .
cpFileName: The name of the source database including full path and extension information if desired. The type of the source database must be the same as the type of the current database (i.e., if the current database is SDENTX, the source database must also be SDENTX).
If the source database contains memo fields that are to be appended to the target, then the memo fields must also be of the same type as the target database.
iSourceType: Use one of the RDE type defined constants.
SDENTX 1 CA-Clipper DBT/NTX driver
SDEFOX 2 FoxPro FPT/IDX/CDX driver
SDENSX 3 Six SMT/NSX driver
SDENSX_DBT 4 CA-Clipper DBT with NSX indexes
COMMA_DELIM 21 Comma-Delimited Text File
SDF_FILE 22 Space-Delimited (SDF) Text File
TAB_DELIM 23 Tab-Delimited Text File
OEMNTX 31 Source SDENTX file translated from OEM
OEMFOX 32 Source SDEFOX file translated from OEM
OEMNSX 33 Source SDENSX file translated from OEM
cpForExpr: An xBase expression defining a filtered subset to be applied to the source database (e.g., "upper(trim(city)) = 'LOS ANGELES'"). If all of the records in the source file are to be appended, pass the parameter as NULL. In Visual Basic pass it as 0& (long integer zero).
If the append is successful, a non-zero value (TRUE -1) is returned. If the function fails, zero (FALSE) is returned. If the source file is empty, TRUE is returned.
If sx_AppendFrom("c:\vb\sxqueue.dbf", SDEFOX, 0&) Then
MsgBox "Appended file successfully"
Else
MsgBox "Appendfrom failed"
End If
sx_GoTop
BoxSelect.Text = Format$(LogArea, "00")
BoxCount.Text = Format$(sx_RecCount(), "#####0")
void CNamesForm::OnButtonAppendBatch()
{
if (!sx_AppendFrom("c:\\vb\\sxqueue.dbf", SDENTX, NULL))
AfxMessageBox((LPCSTR) "Batch append failed.");
else
sx_GoTop();
}