Using Lookup Mode
Rather than modify and potentially mess up your running AssemblyLine, you will make a copy and then change the copy instead. Do this by right-clicking on the 'CSV2XML.assemblyline' and selecting Copy.
Figure 1. AssemblyLine Copy function
Now right-click on the 'AssemblyLines' folder in the Navigator and select the Paste option. Call this new AssemblyLine 'CSV2XML_LookupMode' and then double-click on it to open the AL editor.
You can now remove the ConnectorLoop along with all components under it. Just select it and press the Delete key. In its place you will be dragging in a JDBC Connector that you will copy from another AssemblyLine.
But first you must build the database table that this Connector will be reading from; or rather, you must run a pre-built AssemblyLine to build it for you. To do this, use a file browser to navigate to the 'Tutorials' folder and locate the file called CreatePhoneDB.assemblyline. Drag it into the CE window on top of the 'AssemblyLines' folder in the Navigator panel.
Figure 2. Copying an AssemblyLine into your project
The AssemblyLine will be imported into your project. Now right-click on it and choose Run AssemblyLine...
Figure 3. Run the CreatePhoneDB AL
This AssemblyLine will first create a Derby¹ database under your solution directory called 'TutorialDB' and then set up a 'PhoneDB' table. It will then loop through PhoneNumbers.xml and load this information into the new table².
If all goes well then the log output should look like this:
Figure 4. Log output from the 'CreatePhoneDB' AssemblyLine
The 'CreatePhoneDB' AssemblyLine has a JDBC Connector that is already configured and ready to use. You are going to copy this component to your Project Resource library (specifically, to the "Connectors" folder) and then reuse it in your AL.
Open up the 'CreatePhoneDB' AssemblyLine, grab the Connector called 'PhoneDB' and drag it to the 'Connectors' folder located under 'Resources' in the Navigator tree.
Figure 5. Drag a Connector to Resources
Close 'CreatePhoneDB' so that your own AssemblyLine is visible again. Then drag the new 'PhoneDB.connector' resource into the spot previously occupied by the ConnectorLoop.
Figure 6. Drag the new resource into your AssemblyLine
- Inheritance
- Lookup search rules = Link Criteria When you selected Lookup mode then a new tab labeled 'Link Criteria' appeared in the Connector editor. Link Criteria is for defining the matching rules for the search.
- Deciphering Run errors
¹ Apache Derby is an open-source relational database, bundled with IBM® Security Verify Directory Integrator.
² Although the AL will not be covered in this documentation, it is a good example of advanced scripting techniques used to exploit the data source-specific functionality found in most Connector Interfaces. Feel free to examine and play with this AssemblyLine.