Context Methods

Implementation of context methods is required when additional customization is needed for recognition of record/field delimiters, to filter output records, to perform custom calculation of output values and other tasks.

Context methods are obtained from the context menu (by right clicking) in the script editor or variables pane.

Context methods are called by TextConverter during the conversion process and can be divided into two groups:

1. Methods called once for each process: 

OnStartProcess

OnStartProcess is called before the first input record is processed. Implement this method if you want to make any kind of custom preparation for the process like creating a new file for custom output, setting up a database connection to be used as an additional reference during the conversion and so on.

OnFinishProcess

This method is called after the last input record is processed. Implement this method if you want to customize the final actions after the conversion process is done.

OnSetUp

OnSetUp is called before connections to all datasources used or referenced are established allowing you to alter input/output datasources safely.  Any and all setup or alteration of input and output datasources should be done at this time.

2. Methods called within the processing before processing each next input text line, for each input record, or for each output record:

OnOutputRecord()

OnOutputRecord is called in Auto mode (when using visual templates) before an output record is inserted into the output database table. This is the primary method to be implemented for custom calculations of output values, input record analysis, filtering of output records, and other tasks.

IsNewRecord

IsNewRecord is called for each new line of the input text. An implementation of this method is needed to handle an irregular record delimiter. For example, a record number is a designated record delimiter and several input text lines belong to a single input record. You can not use the record delimiter option for a non-constant delimiter like this, but you can easily solve the problem by implementing IsNewRecord.

OnRecord

Is called for each input record before the corresponding output record is inserted into the output database table. That is the primary method to be implemented for custom calculations of output values, input record analysis, filtering of output records and other tasks.  (See samples and walkthroughs for more information)

OnRecordDone

OnRecordDone is called after TextConverter has inserted a new output record into the output database table. You would rarely implement this method.  Its primary use is handling of custom errors.

To start the implementation of a context method, create a placeholder for a new method - right click in the script editor and select a method name from the context menu. 

See also

This. Methods

TextConverter specific objects

Common objects Reference