Log out?

eiConsole Advanced – Transformation / File Specification

eiConsole v.23R1
Tutorial & Interface

Using Field Record Controls


This interface and related tutorials demonstrate the use of the File Specification Editor in Route configurations to convert between fixed-width Formats, which require conditional Record selection and XML. In this particular exercise, an existing Route (from “Training – Creating a Simple Route”) is modified to transform a fixed-width representation of a “farm” into a well-structured XML format. This tutorial will cover using “Field Record Controls” in File Specifications to conditionally select Records in a fixed-width format. This tutorial expands on the concepts of “File Specifications Handling Fixed-Width Files,” so users are expected to be familiar with that content.

How to Use This Example

Download the INTERFACE file and save it to your local disk.

icon_sample-dataSample Data

Open the eiConsole, click on the File drop-down menu and select Import Working Directory/Route/Format. Highlight the name of the file to import and press the Import Selected button. The imported Interface will appear in your current Working Directory.

Next, follow the tutorial and walk through it step-by-step. You may check your work against the provided Route (Sample Data).

Creating and Configuring a New Route

Begin by creating and configuring a new Route similar to the one created in “File Specifications Handling Fixed-Width Files.” Select the “Source Transform” stage and add a new Format, this time called “Delimited Farm to XML”:

Select the “Delimited and Fixed-Width File” Transformer and click Edit to open the File Specification Editor:

Select “User-Defined” from the drop-down and configure this File Specification with “\r\n”-delimited Records and Fixed-Width Fields:

Create the following Records and Fields with these lengths:

When completed, the structure should look like this:

Load in the “farm.txt” sample file:

There is one key difference between this File Specification and the one covered in the fixed-width tutorial: there are multiple Records. As you can see from the sample, there is no guaranteed order for the Records, nor is there any indication that there’s a particular occurrence limit; each Record can occur any number of times. Another facet is that each Record’s first three characters define the Record type. For example, “ANI” indicates an “Animal,” while “BUI” indicates a “Building.”

This is a fairly typical pattern for delimited and fixed-width formats. Some Field within the Record definition indicates the type of Record with varying levels of complexity. Some formats make use of many, many nested, conditionally-selected Records.

Selecting the Correct Record

In order to select our correct Record based on the first three characters (the “indicator”), we’ll need to make use of a File Specification concept called a “Record Control.” Record Controls are components that select or alter the contents of Records or Fields based on some configuration. The Record Control we’ll be using is called the “Field Record Control.” To make use of it, right-click on the “Base” Node and select “Specify Record Control”:

This will raise a dialog where you can select from a list of defined Record Controls:

As we have no such Record Controls defined, click the “Define new…” button to raise another dialog:

In this dialog, you can specify a “Record Control Type” via the drop-down and its name. Select the “Field Record Control” and leave the default name:

Click “Add Record Control,” then click “Select.” You should now see the Record Control entry in the structure panel:

Select the “Field RecordControl” entry and the bottom configuration panel should change to reflect it:

A Field Record Control has three components:

Adding Definitions

We’ll start by defining a Control Field. Right-click the Control Fields entry and select “Add.”

This will raise a dialog where you can define a Control Field:

The first part is the “Field Name,” which is what we’ll be using to identify the Control Field in later cases. We’ll call ours “RecType”:

Next, we can define the Start and End of this Control Field. Since we’re testing the first three characters for “ANI,” “EMP,” or “BUI,” provide “1” and “3”:

Click “OK,” and then right-click on Control Cases and click “Add” to start defining our tests.

Each Control Case has an If Test Field (the name of the Control Field we’re testing), an Equals Value (the value we’re testing against), a Then Use Record (which Record to use if the Test Field matches Value), and an Occurrences Limit (how many times this case can apply). We’ll provide an entry for “ANI” against the Animal Record:

Define similar cases for EMP → Employee and BUI → Building.

Next, we’ll need to define a default Record if no match is found. Right-click on Default Case and select “Define”:

We’ll provide “Unknown” for our Default Record Name, then click “OK.” Our final configuration should look something like this:

Testing the Results

Finally, click the “Execute Transform to XML” button to test the results:

Save the File Specification, close the Editor, return to the eiConsole, and test the Route from end to end using the provided sample file. Here’s the resulting “before”:

And here’s the “after”:

You can use Record Controls inside Records as many layers deep as necessary.

This concludes the tutorial.

This is a unique website which will require a more modern browser to work! Please upgrade today!