You can use a subflow as the last stage in a flow to write data to a file or
database and even perform some processing on the data before writing the data to the
output destination. You can create a subflow as simple as a single sink stage that
is configured in a way that you want to reuse in multiple flows, or you could
create a more complex subflow that processes data in some way before writing it to
the output destination.
In Spectrum Enterprise Designer, click File > New > Dataflow > Subflow.
Drag an Input stage from the palette to the canvas.
Double-click the Input stage and add the fields that the subflow will receive
from the flow in which it is used.
After configuring the Input stage, add additional stages as needed to perform
the post-processing that you want.
At the end of the subflow, add the appropriate sink.
For example, if you created a subflow that uses a Transformer stage to trim
white space and standardize the casing of a field then writes it to a
database, you would have a subflow that looks like this:
Select File > Save and save the subflow.
Select File > Expose to make the subflow available to include in flows.
In the flow where you want to include the subflow, drag the subflow from
the palette to the canvas and connect it to the last stage in the
flow.
Note: Since the subflow contains a sink stage rather than an Output stage, the
subflow icon only has an input port. It can only be used as a sink in the
flow.
The parent flow now uses the subflow you created as a sink. For example,
if you created a subflow named "Transform and Write to DB" and you add the
subflow and connect it to a Geocode US Address stage, your flow would
look like this: