Home
SQL File Import online help Prev Page Prev Page
Introduction
About SQL File Import
Version history
Contact us
Supported database engines
Using SQL File Import
Home page
Task Wizard
Select source data
Files as source data
CSV source data files
Excel source data files
Enter file search patterns
Connect to database
Conecting to databases directly without client libraries installed
Connecting to an Oracle database
Database scripts
Select table to upload into
Map data to table columns
Review script results
Transaction options
Logging options
Finalise
Run task
Scheduling a task
Options
Scripting
Global variables
OnBeforeUpload function
OnAfterUpload function
Support functions
Data functions
Log functions
String functions
Date and time functions
Date-Time format strings
File functions

OnBeforeUpload function

This function has the following syntax:
 
function OnBeforeUpload(Input: Variant; var UseFileContents, IsKeyField, SkipField: Boolean): Variant;   
begin  
end; 

Parameter name
Description
Input
If the source data type is files, this is the file name. For CSV and Excel files, this is the data column in the source file.

UseFileContents
Set this value to True if the value is a file and you want SQL File Import to upload the contents of the file.

Default value is False.

IsKeyField
Set this value to True if the linked target column is to be used as a key field in an update or delete operation.

Default value is False.

SkipField
Set this value to True if you want SQL File Import to skip this field during the import.

Default value is False.

 
 
The result of the OnBeforeUpload function is the value that SQL File Import will use to process the target column. If you do not want to change the input value in any way, simply assign the input value to the result e.g.
 
function OnBeforeUpload(Input: Variant; var UseFileContents, IsKeyField, SkipField: Boolean): Variant;   
begin  
  Result := Input;  
end; 
 
If the value is a file name, and you want SQL File Import to upload the contents of that file, set the UseFileContents value to True e.g.
 
function OnBeforeUpload(Input: Variant; var UseFileContents, IsKeyField, SkipField: Boolean): Variant;   
begin  
  Result := Input;  
  UseFileContents := True;  
end;