By Marie Scott and Thomas “Duffbert” Duff
So now that you’ve got TDI set up and running on your workstation, the question becomes how to make it do something useful.In this installment, we’ll take a CSV file containing some data and use TDI to load a Notes database on a local Notes server. This is a very basic example, but it’s something that all Notes developers and administrators have had to do numerous times. And our hope is that it will start to acclimate you with the basic steps to set up a TDI AssemblyLine.
So first, start up TDI as well as your Domino server and Notes client. In this example, we have a CSV file of book titles that Duffbert has read, and we want to import that into a Notes database (so he can keep track of what he’s already read).
Nothing fancy here… We’re just looking to get the basics in connectivity down.
So begin by starting Tivoli Directory Integrator. When it first loads, you’ll see a blank command screen (which is the Java background task loading), then the TDI GUI will load. To begin, you’ll want to create a new configuration. That’s done by using the File > New menu option, which will present you with a dialog screen.For this example we’ll call this configuration blogExample01.xml.
That will create your entire project you’ll use going forward. The next thing you need to do once this is done is to make sure you have a particular entry in your java.library.path setting. This is very important when you are running this in local Notes mode. TDI will attempt to find the nlsxbe.dll file during the running of your import, so you have to be sure to have that path in the above java.library.path setting. In this particular instance, we added c:\Program Files\IBM\Lotus\Domino. Without that entry, you will receive a number of errors when the import starts to run.
Creating your new AssemblyLine comes next by using the Object > New AssemblyLine menu option. We called ours CSVToNotes:
With the AssemblyLine in place, we create our first connector to feed in data from the CSV file. That is created with the Object > New Connector option, and you’ll want to choose the ibmdi.FileSystem connector type. That’s the connector that can read a flat file from your workstation. Give it a descriptive name (ReadCSVFile in our case) and put it in Iterator mode. That means it will iterate through the entire file when used:
Our input connector feed is now created! On the file path field, point to where you have the CSV file stored:
The next step is where things get cool… if you click on the plug icon in the Input Map tab, TDI will automatically make a connection to your CSV file.Then if you click the forward icon next to it, TDI will iterate through the detail of the CSV file so that you can see the data you have stored out there. These two steps will assure that you have connectivity to get to your data:
The final step you need to do here is to highlight all four of the entries, and drag them over to the Work Attribute column next to the field names. This is what will allow us to map the CSV columns to the Notes field names:
Half your work is now done! The next step is to create your other connector, the one that will allow you to write out to the Notes database. This time, select the ibmdi.Notes connector wit h a mode of Add-Only. We named our output connector OutputNotesFile:
Again, we’ll go to the connection tab under the Configuration tab and set up the connection information to the Domino server we have on the workstation. This will obviously be specific to however you have your Domino server configured:
At this point, we are simply mapping the CSV columns to the Notes form fields. Refer to the screen picture below:
To get one or more columns from the CSV file, drag them from the Work Entry area on the lower left side into the Connector Attribute column.You can single-click on the Connector Attribute name in order to change it to the Notes field name. In this case, the column names and the Notes field names were the same. Then when you have the Connector Attribute field selected, make sure it’s connected to the right CSV column in the Select from work entry attributes area.
For our Notes form, we do need to add one field that isn’t in there. The Form field is needed so that Notes knows what form to launch the document with. Here’s the example for that field:
We clicked on the Create New Attribute icon at the top of the Connector Attribute column. We then gave it a name of Form, selected a type of Advanced (JavaScript), and used the code snippet of ret.value=”frmBook”; to make sure that each document we create has a Form field in it.
Go ahead and save your work to make sure nothing happens to it at this point!!
Now it’s time to see the fruits ofyour labor.In the upper right corner of the TDI screen, you have your run options:
Once you set it to run, you’ll see an output screen of runtime messages from TDI, and hopefully a newly populated Notes database!
Now that you have the basics set up, you can easily and quickly develop new connectors and AssemblyLines to feed in CSV files to Notes with little programming involved. [Marie – Duffbert are you really saying that this might be useful to application developers?!]
Here’s one of our diagram’s summarizing the process:
And this is just the basics! In our next article we’ll present a method for connecting to LDAP and we’ll get into more of the programming and hooks you can create with JavaScript that end up making TDI a far easier tool for Domino integration than having to manually set up new LotusScript jobs for every new import.
