Tutorial & Interface
Transformation Using Transaction Attributes
This interface demonstrates how to utilitize Transaction Attributes when transforming documents in the eiConsole, in this example using the filename of the incoming file. Transaction attribute based transformation may be used when: Data has been stored to a transaction attribute that needs to be utilized in the transformation Data needs to be written from a transformation into a transaction attribute.
The tutorial demonstrates how to utilize transaction attributes in data transformation; this is useful for getting meta information from listeners, such as when you need to know the filename a file was picked up as. It can also be used to store information which cannot be stored in the current transaction data, or for handling things such as images.
How to Use This Example
Click the links below for the files you will need for this tutorial, then download the INTERFACE to get started. (Once logged into the eiConsole it immediately shows up in your “PIE” inbox for use.)
Note: if you are not logged in to the eiConsole, or have arrived at this page via a browser, you will be prompted to login before the interface downloads into your eiConsole “PIE” inbox. Or if you have not downloaded and installed a FREE eiConsole Trial you will have the opportunity to register after you click the Interface Download link. Once you are logged in the interface will automatically download into your “PIE” inbox. First, you’ll see a screen pop up indicating that a new product is ready for download. Select the Download Now button. Once you’ve downloaded the Interface you can drag it into your current Working Directory and begin.
Next, follow the tutorial and walk through it step-by-step. You may check your work against the provided Route (Sample Data).
Double click the interface to open the Route
This interface has three functioning pieces; the Listener, the listener transformation, and the transport.
The listener polls a directory set by a configuration value stored in the environment properties file (included with this interface) every five seconds. The sample files intended to be used with this interface are provided alongside this instructional guide; they are Sample2.xml and Sample3.xml.
The transformation is relatively simple, performing a near one-to-one mapping, except for a single field; FileName.
To write a transaction attribute, navigate to the “Custom” tab in your Data Mapper palette, and select “Attribute” – “Get Transaction Attribute”. After dragging and dropping it to the desired Node, it automatically generates the XSLT necessary to read data in from a transaction attribute in your XSLT.
It will ask you to provide an attribute name.
In our case the Filename node is already mapped.
You can test this directly in your XSLT; go to the Testing tab, and on the testing toolbar is an icon of a green pencil and notepad. Clicking this will bring up an attribute editor; this data will be given directly to the transformer when this test is executed. Enter attribute name com.pilotfish.FileName and the value TestName, and hit the Enter.
The new element will appear in the results window:
We use the original file name and extension for the output of this transport, information produced by the directory listener as a transaction attribute; note that, because we have three incoming Transactions which will share this information, the output file name will, subsequent to the first file output, have a number appended to the end.
Run the Testing Mode.
Click on the Execute Test and copy the Sample2.xml file to the polling directory.
Since our sample file is Sample2.xml the new node in the newly created file will contain the name of it – Sample2.
This concludes this demonstration of using attributes in transformations.