1.1 Products


- regular field and record delimiters
- first line contains the field names
- edit output dictionary
- simple script customization of an output value

location:  InstallDir/Samples/TextConverter/Manual Mode/1 Well formed input/

project file:  InstallDir/Samples/TextConverter/Manual Mode/1 Well formed input/1.1 Products.ConverterX

1. Launch TextConverter or clear the project by pressing the New button () in the tool bar or by selecting "New" from the "File" menu.

2. Make sure "Get field names from the line #" option is not set.

Open the "1.1 Products.txt" input text file. (See loading an input file for details.)

Input and output dictionaries are populated automatically. You can see that input and output field names are initialized with default strings Field_1, Field_2, etc.  However, many text files have a list of field names as the first line in the text. Set the "Get field names from the line #" option to 1 and see that the change is immediatly reflected by all of the TextConverter panes: the input and output field names are populated with the names retrieved from the input text file.

3. Let's say we need more fields in the output database table than we have in the input structure. Create a new output field by clicking on an empty item (the last one) in the output dictionary list or selecting "New Item" from it's context menu. Set the new field name to Price10, set the type to Numeric and width to Currency. You can see that the new field has appeared in the output preview pane as an empty column. To initialize the new field values we should either connect it to an input field to use the default conversion or script a custom conversion. Click with the right mouse button on the new field in the output dictionary list and select "Create script conversion" from the context menu. A new context method OnRecord is created for you in the script editor along with a template line:

DictOut.Price10.value = Empty

Let's calculate a new price, which is a 10% increase from the current price:

DictOut.Price10.value = DictIn.PRICE.value * 1.1

Now the preview pane shows the correct values for the new field.
Select the output database table and click Run () to start the conversion.

Go to 1.2 AutoLog for more training.

Related Sections

TextConverter's Concept

Setting up a Conversion: Step-by-Step

Samples and Walkthroughs

User Interface

Programmer's Reference, Scripting