Examples

Loading data into MS SQL Server

// force VImpX not to use connection details from the script file 
VImpAX1.ParseConnection:=false;
//Stops user from changing connection parameters through the interface 
VImpAX1. SourceConnectionEnabled:=False;
VImpAX1. TargetConnectionEnabled:=False;
//Hides Script and Sql tabs
VImpAX1.HideScriptTab:=true;
VImpAX1.HideSqlTab:=true;

// specify Target
VImpAX1.TargetType:=1; //- dtSqlServer
VImpAX1.TargetServer:=’Server1’;
VImpAX1.TargetDatabase:=’db11’;
VImpAX1.TargetUserName:=’user1’;
VImpAX1.TargetPassword:=’blah’;
VImpAX1.TargetTable:=’mytable’;

// specify Source
VImpAX1.SourceType:=0; //- dstext
VImpAX1.SourceFile:=’c:\1.txt’;
VImpAX1.SourceFileDelimited:=true;
VImpAX1.SourceFileDelimiter:=’,’;

//Load Script From file
VImpAX1.LoadFromFile(‘c:\myscript.txt’);

VImpAX1.LogFile:=’c:\1.log’;
VImpAX1.RejectedRecordsFile:=’c:\rej1.log’;

VImpAX1.LoadData;

Loading into MySQL Server from user Application

// forces VImpX not to use connection details from the script file  
VImpAX1.ParseConnection:=false;
//Stops user from changing connection parameters through the interface  
VImpAX1.SourceConnectionEnabled:=False;
VImpAX1.TargetConnectionEnabled:=False;
//Hides Script and Sql tabs
VImpAX1.HideScriptTab:=true;
VImpAX1.HideSqlTab:=true;
VImpAX1.LogFile:='c:\1.log';
VImpAX1.RejectedRecordsFile:='c:\rej1.log';
VImpAX1.TargetType:=9; //- dtMySQL
VImpAX1.TargetServerName:='localhost';
VImpAX1.TargetDatabase:='test';
VImpAX1.TargetUserName:='root';
VImpAX1.TargetPassword:='liga56';
VImpAX1.TargetTable:='xxx';
VImpAX1.SourceType:=36; //- dsApplication
// Load Mapping
VImpAX1.LoadFromFile('c:\1.vis');
//Load  Data 
VImpAX1.StartImport;
for I := 0 to 100 do // Loading data          
 begin
  VImpAX1.ApplicationSourceDataRow:=IntToStr(i)+#9+'F21';
   If VImpAX1.CurrentStatus<>’OK’  then
     ShowMessage(CurrentMessage)
 end
VImpAX1.FinishImport;

Loading from MS SQL Server into user Application

// forces VImpX not to use connection details from the script file
VImpAX1.ParseConnection:=false;
//Stops user from chaging connection parameters through the interface
VImpAX1.SourceConnectionEnabled:=False;
VImpAX1.TargetConnectionEnabled:=False;

//Hides Script and Sql tabs
VImpAX1.HideScriptTab:=true;
VImpAX1.HideSqlTab:=true;
VImpAX1.LogFile:='c:\support\1.log';
VImpAX1.RejectedRecordsFile:='c:\rej1.log';

VImpAX1.SourceType:=9; //- dtMySQL
VImpAX1.SourceServer:='localhost';
VImpAX1.SourceDatabase:='test';
VImpAX1.SourceUserName:='root';
VImpAX1.SourcePassword:='xxx';
VImpAX1.SourceTable:='registry';
VImpAX1.SourceTables:='registry';
VImpAX1.SourceIsTable:=True;

VImpAX1.TargetType:=36; //- dsApplication
VImpAX1.ApplicationTargetFields:='F01'+#9+'F02';
VImpAX1.UpdateSourceData;

 // Load Mapping
VImpAX1.LoadFromFile('c:\support\Testing.vis');
VImpAX1.LoadData; or // VImpAX1.LoadSilent

Than use event onWriteApplicationDataRow to get data from the database

Preparing Mapping

// forces VImpX not to use connection details from the script file
VImpAX1.ParseConnection:=false;
//Stops user from changing connection parameters through the interface  
VImpAX1.SourceConnectionEnabled:=False;
VImpAX1.TargetConnectionEnabled:=False;
//Hides Script and Sql tabs
VImpAX1.HideScriptTab:=true;
VImpAX1.HideSqlTab:=true;
VImpAX1.LogFile:='c:\1.log';
VImpAX1.RejectedRecordsFile:='c:\rej1.log';
VImpAX1.TargetType:=9; //- dtMySQL
VImpAX1.TargetServerName:='localhost';
VImpAX1.TargetDatabase:='test';
VImpAX1.TargetUserName:='root';
VImpAX1.TargetPassword:=’xxxx’;
VImpAX1.TargetTable:='test2';
VImpAX1.UpdateFieldsList;
VImpAX1.SourceType:=36; //- dsApplication  
VImpAX1.ApplicationSourceData:='F11'+#9+'F21'+#13#10+'F12'+#9+'F22';       
ImpAX1.UpdateSourceData;

For more technologies supported by our ETL Software see Advanced ETL Processor Versions and Visual Importer ETL Versions

Confused? Ask question on our ETL Forum

  • vimpx/examples.txt
  • Last modified: 17/09/2018 10:30
  • by admin