Exercise 3.3b Using Common Transformers
Data 3-1-1 case location details (XLS hosted on FTP)
Overall Goal Add a transformer to clean up schema
Create a summary table
Demonstrates Common transformer procedures
Start Workspace C:\FMEData2018\Workspaces\IntroToDesktop\Ex3.3-Begin.fmw
End Workspace C:\FMEData2018\Workspaces\IntroToDesktop\Ex3.3-Complete.fmw

Did you find a transformer that works? The easiest one to use is the StatisticsCalculator. Let's add it to our workspace.


TIP

Again, there are often multiple solutions to a given problem in FME. We could accomplish roughly the same result by using:


1) Start Workbench

Start Workbench (if necessary) and open the workspace from Exercise 3.2. Alternatively you can open C:\FMEData2018\Workspaces\IntroToDesktop\Ex3.3-Begin.fmw.

2) Add a StatisticsCalculator

Click on blank canvas, then type "StatisticsCalculator" and hit Enter when it appears on the Quick Add menu to add it. Click and drag from the Output port of StringReplacer_2 to the Input port of StatisticsCalculator. Then, click and drag the StatisticsCalculator to place it between and slightly above your StringReplacer_2 and writer feature type.

Your workspace should look like this:

We aren't going to connect the StatisticsCalculator to our feature type just yet; we'll discuss why in step 5 below.

3) Set StatisticsCalculator Parameters

Double-click the StatisticsCalculator to open its parameters. Fill them in like this:

Parameter Value
Group By Department and Local Area
Attributes to Analyze Case Type
Total Count Attribute Cases

Additionally, make sure you remove the values from all the other Calculated Attributes (Minimum Attribute, Maximum Attribute, etc.). You can do this by selecting the parameter and deleting it with the Delete or Backspace key, or by clicking the drop-down arrow and selecting Clear Value:

When finished, your parameters should look like this:

Click OK and use Run To This on the StatisticsCalculator type to summarize your data.

With these parameters, the transformer will add an attribute, Cases, to your data, which sums count of Case Type. By setting Group By to Department and Local Area, we get the total count for each unique combination of department and local area.

4) Inspect the Cache

Let's inspect the cache to ensure our data looks correct. Click on the green inspect cache icon on the Summary output port of the StatisticsCalculator. The StatisticsCalculator illustrates that transformers vary in the number of input and output ports they have. The Summary port outputs a summary table of the results, resulting in a new stream of features (here, 329), while the Complete and Cumulative ports add the results of the summary to every incoming feature (here, 93,223).

In the Data Inspector, you should see this in the Table View:

This result is a good start, but now that our data's schema has changed, we have different attributes than those on our existing writer feature type. We can add a new writer feature type to write the summary table to. We'll do that in the next section.

CONGRATULATIONS
By completing this exercise, you have learned how to:
  • Use the StatisticsCalculator to generate a summary table.
  • Use group-by to group features in a transformer.
  • Observe that some transformers have multiple output ports creating different streams of data.

results matching ""

    No results matching ""