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 called by TextConverter during the conversion process and can be divided into three groups: 1. Methods called once for each process: OnStartProcess, OnFinishProcess 2. Methods called before processing each next input text line: IsNewRecord 3. Methods called for each input record: OnRecord, OnRecordDone To start the implementation of a context method, you can create a placeholder for a new method by typing it into the script editor. You can also use one of the following three user interface based approaches: OnStartProcessOnStartProcess 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. Function: OnStartProcess Dim fso, file OnFinishProcessThis 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. Function OnFinishProcess This sample closes the text file created in the previous sample: Function OnFinishProcess IsNewRecordIsNewRecord 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. Function IsNewRecord( text_line ) This sample illustrates how to handle a non constant record delimiter (record number) Function IsNewRecord( text_line ) OnRecordOnRecord 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) Function OnRecord This sample shows how to implement OnRecord to have an output field as a function of two input fields Function OnRecord OnRecordDoneOnRecordDone 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. Function OnRecordDone( ok ) This sample demonstrates custom error log implementation. db_log is a DataObject variable Function OnRecordDone( ok ) Related SectionsSetting up a Conversion: Step-by-Step |