Databases Reference
In-Depth Information
We'll name this file as
states.csv
and drop it into the
DataIn
folder too.
Of course, the state lookup data could be held in lots of different containers, such
as an XML file, relational database, even a third-party web service; but for now we'll
work with a plain old text file.
Let's start by creating a new job named
StateLookup
. Then, follow these steps:
1. Create file delimited metadata for the two input files,
corporate-
addresses.csv
and
states.csv
, following the same steps as
used previously.
When creating the corporate addresses metadata, the wizard
defines zip as a data type of integer, based on the data presented
in the file. This is okay if the file contains US-only addresses,
but might not be okay if the file contains a mix of US and other
addresses. If this were to be the case, you would modify the data
type here to string, to cope with other zip code formats.
2. Drag each metadata component onto the Job Designer, selecting
tFileInputDelimited
in each case.
3. Now search for
join
in the
Palette
window, grab a
tJoin
component,
and drop it onto the designer. This is the component that will join our
two data streams.
4. Right-click on the corporate addresses file component, select
Row | Main
,
and drop the connector onto the
tJoin
component.
5.
Right-click on the
states
file component, select
Row | Main
, and again
drop this onto the
tJoin
component. You'll notice that, even though we
selected
Row | Main
in both cases, the resulting connector is slightly
different. The first connector we made in step 4 is noted as
Main
, while the
second is called
Lookup
. The order in which we connect the components to
the
tJoin
is important. Join the primary data stream first, and one or more
lookup components subsequently.
If you join connections in the wrong order or wish to change which
is the Main dataflow and which is the Lookup dataflow, you can do
this by right-clicking on one of the connectors and selecting
Set this
connection as Lookup
or
Set this connection as Main
.
Search WWH ::
Custom Search