Execute VB code before transferring data

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

 

After activating this step - which can be done on page Enabled actions - and clicking tab VB code (1; 6) you can provide a piece of Visual Basic code you want to be executed when the configuration starts running. Methods defined on page Own VB functions can be called as well. The button below the input field verifies the syntax of the code.

 

code_before

 

Some predefined constants are available from this code containing values from text boxes on page Configuration groups of the simple view (which in turn are parameters of the source and target connection strings and the otherwise unused Additional parameters), these are:

 

ReadOnly sourceServerName As String' Source -> Server
ReadOnly sourceDatabase As String' Source -> Database
ReadOnly sourceUsername As String' Source -> Username
ReadOnly sourcePassword As String' Source -> Password
ReadOnly sourceAdditionalParameter As String' Source -> Additional parameter
ReadOnly targetServerName As String' Target -> Server
ReadOnly targetDatabase As String' Target -> Database
ReadOnly targetUsername As String' Target -> Username
ReadOnly targetPassword As String' Target -> Password
ReadOnly targetAdditionalParameter As String' Target -> Additional parameter

 

Three other constants are also available and two predefined objects with specific roles:

 

ReadOnly groupName As String' Name of the group containing this configuration
ReadOnly configurationName As String' Name of this configuration
ReadOnly groupsDirectory As String' Directory in which configuration groups of the plugin (.group files) are located

 

auxiliaryTables As Dictionary(Of String, DataTable)' Object containing auxiliary tables' names and the tables themselves. Tables of the source

 ' database selected as auxiliary on page Connection are not available at this time, however

 ' virtual tables (virtualTable1 - virtualTable8) are

log As List(Of String)' The list log allows you to create your own log entries: lines in it will be added to the

 ' plugin's event log once this code is executed

 

Warning: configurations are executed by the scheduler of the plugin, thus code provided here is treated as if it belonged to a Windows service and is usually not capable of interactive actions such as displaying dialog boxes.