Let's take a look at the feature writer transformer.
The feature writer is, well, kind of a big deal.
Why?
Because it allows you to write data anywhere in your transformation.
This means that you can process data, write it out midway, then continue with the processing.
The workspace is doing attribute validation, writing the invalid features to excel with
the feature writer and continuing on and sending out an email with a link to the Excel file.
Before the feature writer was around we would've had to place an Excel writer and write some
Python shutdown code to handle the emailing, or we would've had to use our workspace runner
to call another workspace.
So you see the feature writer makes life much easier.
Let's take a closer look at this transformer.
Here is the previous workspace we are reading in parks data, performing some attribute validation,
then doing some processing on the validation results.
Let's inspect the data after the string searcher.
These are the parks that failed validation.
There is a new failed validation attribute that tells us the reason for the failure.
Now comes the feature writer.
Our goal is to write these features to an Excel spreadsheet then continue on with the
translation.
Go ahead and place a feature writer on the canvas.
Connect the matched port of the string searcher to the connect input ports of the feature
writer.
Notice the name of the input port changes to matched.
Open the properties of the feature writer.
The top part of the dialogue is similar to the ad writer dialogue.
Choose an Excel writer and output location.
Click on the parameters button and set the overwrite file parameter two yes.
The middle part of the dialogue is split into left and right parts.
The left-hand side lists the feature types we have defined and lets us pick which one
to deal with.
Notice that the list is the same as the input ports we have on the transformer.
In fact you can add new feature types by simply making new connections to the transformer.
Back into the feature writer parameters, you can decide which one to use for the output
schema.
Notice how the sheet name changes based on the feature type selected.
The right-hand side is like the feature type parameters dialog and it has the same tabs.
These should be identical to the proper writer feature type dialogs, meaning, you can set
dynamic parameters and feature type fan outs.
Let's set up a fan out.
For sheet name select the failed validation attribute.
Now there will be a sheet created for every unique failed validation value.
Let's clean up the user attributes and delete those that we don't need.
The bottom part of the feature writer dialogue deals with the output from the transformer
by creating attributes summarizing the writing process.
The attributes defined here contain the name of the data set written, the feature types
written, and the number of features written.
Since we can do further transformation after the data is written, it makes sense that we
will want to know the sort of information.
Now that we've set up the feature writer let's add an inspector to see the outputs and check
that the Excel file gets written.
If we look at the attributes we see details about the written output.
We have the data set the sheet names and the number of features written.
In Windows Explorer we can confirm that the Excel file was written and that we have a
tab for each unique validation failure.
After the feature writer, an attribute creator creates the body of an email text notice our
summary attribute is in use here.
An emailer has been set up to email the Excel file written by the feature writer.
Here's the email that sends when the workspace runs.
You can see how useful this transformer can be.
Who knows, with the feature writer in combination with the feature reader you may find yourself
with the reader-less and writer-less workspace in the near future.