Batch module, Executes Definition sets automatically and at scheduled times
The batch module is ideal for a Definition conversion process that takes a long time to run or for frequently repeated tasks. Examples of these are the Import / Export / Update of large databases, which can be run as an overnight batch job, and the automatic creation of a testing data during a development project.
Example command line
These parameters instruct FlowHeater to run the Definition set ImportTurnover.fhd but only process the first 1000 rows.
Note: If authorization is required to enable connection to a database ( SQL Server, Oracle, MySQL, etc.) for example, the necessary database, username and password details must be stored in the Definition set. For security reasons, all passwords saved in FlowHeater Definition sets are encrypted.
Return Code / Exit Code / Error Level
After running the Batch Module you can test the exit code in batch files (.CMD / .BAT) to find out whether running the started FlowHeater Definition was completed successfully. Code values are
0 = The run completed successfully.
4 = The run ended with warnings.
8 = The run ended with an error message.
12 = The run was aborted with a fatal error. If the Definition that failed used a database Adapter then a rollback of the current transaction will have been performed automatically.
|/? or /help
||Outputs a help description
||At most only the first n records/rows are processed
||Sets the Parameter Name to the value entered.
|/SetParameter Name:Crypt=Value||Sets the Parameter Name to the value entered. The content of this value must previously have been encrypted with the option /Crypt
|/Memory||Enables the memory processing mode
|/Massdata||Enables the mass data processing mode
|/LogFile [filename]||Adds the result to the specified log file
|/LogCompact||This produces a single-line (compact) format for output
|/LogQuote||Encloses individual log entries in quotation marks
|/LogDelete||Deletes the log filename given prior to execution
|/ShowDebug||Outputs debug messages to the shell standard output channel
|/DisableDebug||Disables debug messages
|/ShowWarnings||Outputs warning messages to the shell standard output channel
|/DisableWarnings||Disables warning messages
|/Crypt Value||Encrypts the value for subsequent use with the option /SetParameter Name:Crypt=Value
Options only for TextFile, Excel and XML Adapter
Using the /ReadFileName and /WriteFileName options in the TextFile, Excel and XML Adapters you can define which file should be read or written. If a different Adapter is present on the respective side, attempting to use this option will abort the run with an error message.
|/ReadFileName [filename]||Overrides the default in the definition file. Wildcards like C:\Temp\*.csv are allowed!|
|/WriteFileName [filename]||Overrides the default in the definition file|
As of version 2.x all the options you selected using Designer in the Test and Execute popup are saved within the FlowHeater Definition. You only need the options detailed above when you wish to change the predefined options during batch execution.
e.g. You have a very large volume of data you wish to import/export. While you are setting up the Definition and testing it in the Designer, you select the option to process a maximum of 1000 records. This setting is nevertheless stored in the Definition file. If you now try to run this Definition using the Batch Module without making further changes, only the first 1000 records will be processed. So that the Batch Module processes the complete number of records available, you need to override the option /MaxRows with the value 0 in the task parameters. See example.
FHBatch.exe /MaxRows 0 import.fhd
This will process all available records/rows, regardless of the predefined setting in the Definition file.
Examples of usage
The batch module makes it is easy to export data on a regular basis, for example, every night you could export the day’s turnover figures into a CSV text file automatically. Further potential uses include taking flat files or test data, formatted with fixed column widths, and importing these on demand into an SQL Server database for testing purposes (a feature sure to bring a smile to your developers).
The following examples illustrate the batch module in action