TextConverter' methods and properties provide the ability to access different TextConverter' objects, set and get their data and modify TextConverter' default behavior. The methods and properties can be referenced from the script by this key word: this.MethodName. The Script editor conveniently shows all object methods when you type a dot after this. Once a hint list appears, the method or property name can be typed in manually or just selected from the list: Most of the methods can be used strictly from the context methods, which are called on a per-input-record basis OnRecord, OnRecordDone. The only exception is IsRunning method, which can be called from any context method. PropertiesappendThis property provides access to TextConverters output option. Append is boolean. When Append is true, TextConverter will append the existing output file or table or attempt to create the output file or table if it does not exist. When append is false, TextConverter will always attempt to create the output file or table. You can read or update this property.
bufferBuffer related methods and functions are grouped under this object. In the functions section below see AddRecord, Flush, GetCount, GetField, and GetRecord.
Buffer supports an auto-fill mode. Input records are placed in the buffer automatically in this mode (up to the ‘Buffer size’ property). When the buffer is full it works as a FIFO queue. When ‘auto buffer’ mode is OFF buffer’s behavior/size is controlled by the GetField method which allows scrolling to a buffer’s record and getting a field value in a single operation. DictInThis property provides access to the input fields. The input field values are automatically initialized by TextConverter for each new input record. You may want to retrieve the input field values in your script in order to customize field delimiter recognition or to modify the calculation of output fields. (See samples and walkthroughs for more information)
Function OnRecord DictOutThis property provides access to the output fields. All connected output fields are assigned values from the corresponding input fields automatically by TextConverter for each new input record. You can make any customization to the output values through DictOut. (See samples and walkthroughs to learn more) You can select an output field from the list which appears when you type in DictOut. Each output field has a single property value, which you can set or get. VB sampleFunction OnRecord DSoutDSout related properties, methods and functions are grouped under this object. MethodsSkipRecordCall this method from your implementation of the OnRecord context methods to indicate that the current output record should not be inserted into the output database table. This function is usually used with a heterogeneous input text when multi-level information should be filtered out in order to insert only a specific level into the output database. (See samples and walkthroughs for more information) Function SkipRecord() Function OnRecord GetValueByTagUse GetValueByTag when the input fields are marked by tags and are not separated by constant delimiters. After the input value is retrieved, it can be assigned to an arbitrary output field. Function GetValueByTag( tag, delimiter(optional), start(optional) ) You could handle an input like this: Author="Aberer, Karl", with the following script: Function OnRecord CancelCall this function to stop the conversion procedure. No output records will be appended to the output database table after you call this method. Function Cancel() Function OnRecordDone( ok ) IsRunningThe function is helpful if some portions of your script should run in the real mode only, not in the preview mode. The Preview mode is run when any change is made to your setup if preview auto update option is turned on. Real mode is executed when you press the Run button (
Function IsRunning() Create a proxy database table only in the real mode. Function OnStartProcess( ok ) System buffer management methods (Advanced)Sometimes it is not enough to operate on a per record basis. Let's assume that your input text consists of the following text areas: 219434342 GASKET SET 123.35 3 370.05 19980301 19980630 SUBTOTAL ENGINE PARTS 22 2,446.88 987293744 TORSION BAR 218.50 2 437.00 19980427 19981010 SUBTOTAL SUSPENSION 9 3,139.25 and we would like to merge the subtotal information for each group into each detailed record. The methods, which accumulate, query and extract the data from the system buffer can facilitate the task.
1. Function OnRecord AddToBufferAddToBuffer adds the current input record to the system buffer. Function AddToBuffer() (See the sample for System buffer management methods ) GetBufferCountReturns the number of input records in the system buffer. Function GetBufferCount() (See the sample for System buffer management methods.) GetFromBufferFetches an input record from the system buffer using its index and initializes the input fields of the DictIn object. You can consider the fetched record to be the current input record. Function GetFromBuffer(index) (See the sample for System buffer management methods.) FlushBufferFlushes the content of the system buffer to get it ready for another cycle of record accumulation. Function FlushBuffer() (See the sample for System buffer management methods.) AppendStartPrepares for a record insertion into the output database table. Useful for splitting an input record into several output records or for simply generating a new output record. You must finish the process with AppendRecord (below) Function AppendStart() Function OnRecord this.AppendStart DictOut.Field1.value = val1 DictOut.Field2.value = val2 DictOut.Field3.value = val3 this.AppendRecord End Function 'Example 2 '----------------- OnStartProcess ----------------- Function OnStartProcess 'creates header record this.AppendStart DictOut.Field_1.value = "HEADER RECORD" 'literal value can be anything this.AppendRecord End Function AppendRecordInserts the current output record into the output database table. Returns the unique identifier for the record if such supported by the underlying database system. Function AppendRecord( get_id(optional) ) Function OnRecord this.AppendStart DictOut.Field1.value = val1 DictOut.Field2.value = val2 DictOut.Field3.value = val3 this.AppendRecord End Function 'Example 2 '----------------- OnFinishProcess -----------------
Function OnFinishProcess 'creates footer this.AppendStart For i = 1 to dictout.GetFieldCount(): Dictout.SetFieldValue i, Empty: Next ' clears the fields of prior data DictOut.Field_1.value = "FOOTER RECORD" ' insets leteral but could be variable this.AppendRecord this.AppendStart 'creates empty line For i = 1 to dictout.GetFieldCount(): Dictout.SetFieldValue i, Empty: Next ' clears the fields of prior data this.AppendRecord End Function GetInputFileInserts the current input data source file name into the output database table. Function GetInputFile() Function OnRecord IsDelimitedWhen using automatic extraction and the "Show all lines" option, IsDelimited separates records extracted by implied delimiters from other text data in the document. The main distinction between the lines suppressed by default (or shown with the "Show all lines" option) and the rest of the document is that for the rest of the document TextConverter's AI was able to identify implied delimiters. This function separates the data that IsDelimited from the data that is not. The example script will use SkipRecord to keep the non-delimited records from the automated extraction. You can then extract those records manually. Function IsDelimited() Function OnRecord Related Sections |
