> For the complete documentation index, see [llms.txt](https://1spatial.gitbook.io/fme-form-beginner/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://1spatial.gitbook.io/fme-form-beginner/transformer-usage/managing-attributes/transformer-usage-exercise-1.md).

# Transformer Usage - Exercise 1

<table><thead><tr><th width="176">Exercise Details</th><th>Noise Control Laws Project (Managing Attributes)</th></tr></thead><tbody><tr><td><strong>Locality</strong></td><td>Vancouver, Canada</td></tr><tr><td><strong>Data</strong></td><td>Addresses (File Geodatabase)</td></tr><tr><td><strong>Overall Goal</strong></td><td>Convert a File Geodatabase to CSV and map the schema</td></tr><tr><td><strong>Demonstrates</strong></td><td>Attribute Management for Schema Mapping</td></tr><tr><td><strong>Start Workspace</strong></td><td><em>None</em></td></tr><tr><td><strong>End Workspace</strong></td><td>C:\FMETraining\Workspaces\Transformers-Ex1-Complete.fmw</td></tr></tbody></table>

City councillors have voted to amend noise control laws and residents living in affected areas must be informed of these changes.

You have been recommended by your manager to take on the task of finding all affected addresses. There's a tight deadline, and at least three city councillors are standing watching you work. The pressure is on, and it's up to you to deliver!

This exercise is the first part of the project. You know that the address database for the city is stored in an Esri Geodatabase whose schema matches the Local Government Information Model PostalAddress table.

However, you are told that the software used to carry out automated bulk mailings requires addresses stored in an Excel spreadsheet using a completely different schema.

So, your first task is to create a workspace that converts addresses from Geodatabase to CSV, mapping the schema at the same time.

***

{% stepper %}
{% step %}

## Open a Blank Workspace

As usual, the first task is to familiarise yourself with the data. To do this open a blank workspace and ensure that Data Preview is open: View > Windows > Data Preview.

Open your computer's file explorer and browse to the dataset:

C:\FMETraining\Data\Canada\Addresses\Addresses.gdb

Then drag and drop the Addresses.gdb in the Data Preview window:

<figure><img src="/files/sBD9UV3XBTyVvZpkpxBo" alt=""><figcaption></figcaption></figure>

Once the Geodatabase has been dropped onto Data Preview, a Select Dataset to View dialog will appear. Ensure that the Format is Esri Geodatabase (File Geodb Open API) and go to Parameters, to find the PostalAddress table from within ‘Tables’. For more space you can close the Graphics View as we are only interested in the table:

<figure><img src="/files/QMZv3U8dj5EANTKZKIOp" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

## Add FeatureReader Transformers

Now that you are familiar with the source data, we can add the data to the workspace.

We can choose to read the source data using either a reader or a FeatureReader transformer. The FeatureReader will allow us to build in a spatial filter so, because we believe this project may need some filtering, we'll use a FeatureReader transformer.

Place a FeatureReader Transformer:

<figure><img src="/files/KIVfnkL5SChhdjDuK0PP" alt=""><figcaption></figcaption></figure>

Inspect the FeatureReader parameters and set up the parameters as follows:

<table><thead><tr><th width="176">Parameter</th><th>Value</th></tr></thead><tbody><tr><td><strong>Reader Format</strong></td><td>Esri Geodatabase (OpenFile Geodb)</td></tr><tr><td><strong>Reader Dataset</strong></td><td>C:\FMETraining\Data\Canada\Addresses\Addresses.gdb</td></tr><tr><td><strong>Feature Types to Read</strong></td><td>PostalAddress</td></tr></tbody></table>

<figure><img src="/files/hl2iMwcwGTE4InbZnZ2p" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**TIP**

*Just as with the Data Preview window, datasets can be dragged/dropped into dataset fields in Workbench dialogs.*

*In this case the same .gdb folder could be dropped onto the Reader Dataset fields in the FeatureReader transformer, instead of using the browse for data button.*
{% endhint %}
{% endstep %}

{% step %}

## Add a CSV Writer

Now let's add a writer to write the output data. There currently seems no benefit or need to use a FeatureWriter, so select Writers > Add Writer from the menu bar and use the following:

<table><thead><tr><th width="176">Parameter</th><th>Value</th></tr></thead><tbody><tr><td><strong>Writer Format</strong></td><td>CSV (Comma Separated Value)</td></tr><tr><td><strong>Writer Dataset</strong></td><td>C:\FMETraining\Output</td></tr><tr><td><strong>Sheet Definition</strong></td><td>Import from Dataset</td></tr></tbody></table>

<figure><img src="/files/Xc8LUtFq5xy6FATNPKKJ" alt=""><figcaption></figcaption></figure>

Setting 'Import from Dataset' will let us import an Excel spreadsheet to use as a guide. Click OK to add the writer.
{% endstep %}

{% step %}

## Import Feature Types

At this point you are prompted to select the dataset to import a schema definition from. Set the Dataset parameter as follows:

<table><thead><tr><th width="176">Parameter</th><th>Value</th></tr></thead><tbody><tr><td><strong>Reader Format</strong></td><td>Microsoft Excel</td></tr><tr><td><strong>Reader Dataset</strong></td><td>C:\FMETraining\Resources\AddressSchema.xlsx</td></tr></tbody></table>

This file is our guide/template. Click OK to accept the values:

<figure><img src="/files/jbk4QO2FGfVdjSMoS5LF" alt=""><figcaption></figcaption></figure>

The new feature type will be created to match the chosen Excel schema.
{% endstep %}

{% step %}

## Add an AttributeManager Transformer

Now we can start to map the schema from the reader (FeatureReader) to the writer. As you'll have noticed, the two do not currently match up very well.

So, place an AttributeManager connected between the FeatureReader:PostalAddress output port and the PostalAddress writer feature type.

<figure><img src="/files/TMEG5WEDafGj8xwB69K4" alt=""><figcaption></figcaption></figure>

Its parameters will look like this:

<figure><img src="/files/6wrQLLT0n32qQiyxys5r" alt=""><figcaption></figcaption></figure>

Firstly let's clear up the reader schema by removing some of the unwanted attributes.

Click on the following attributes and either press the Delete key or click the - button on the dialog to remove them:

* OBJECTID
* GlobalID
* INTSTATE
* INTPSTLCD
* REPRESENT
* STATUS
* LASTUPDATE
* LASTEDITOR

<figure><img src="/files/NB7dLhBjryYFHFpdy4oY" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

## Rename Attributes

Several source attributes can be written to the output as they are, but do need renaming first.

In the AttributeManager rename the following:

* PSTLCITY to City
* PSTLPROV to Province
* POSTALCODE to PostalCode
* COUNTRY to Country

<figure><img src="/files/RZulQRXOYotDPz5p30OC" alt=""><figcaption></figcaption></figure>

If the AttributeManager is connected to the writer feature type, then you should be able to select the Output Attribute field from a drop-down list instead of typing it in.
{% endstep %}

{% step %}

## Create an Attribute (Provider)

Two attributes on the output (Provider and UpdateDate) are new and cannot be copied from the source data. They must be created.

In the AttributeManager create the new attribute "Provider." Because the attribute exists on the output schema, you can again select it from the drop-down list.

Set a fixed value such as your own organization organisation name, "Safe Software," or “1Spatial”.

<figure><img src="/files/oaXBV7yssaw170ioF7HZ" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

## Create an Attribute (UpdateDate)

Now create the new attribute "UpdateDate". Rather than hard-coding a value, click on the drop-down arrow in the Attribute Value field and choose Open Text Editor.

In the text editor locate the Date/Time Function called CurrentDateTime and double-click to place it in the editor:

<figure><img src="/files/RB2G0v1CCtvQUNn2yI5x" alt=""><figcaption></figcaption></figure>

By default it creates a datetime in ISO syntax, which is fine for us, so click OK to accept this.
{% endstep %}

{% step %}

## Create an Attribute (Owners)

Notice that there is an Owners field on the output, but there are two owner fields (OWNERNM 1 and OWNERNM 2) on the input. So to set the output attribute we need to concatenate the two input fields. That's simple enough.

Still in the AttributeManager parameters dialog, create a new attribute called Owners. In the Attribute Value column for this attribute, click the drop-down arrow and choose Open Text Editor.

In the text editor open the FME Feature Attributes section on the left-hand menu. Locate the OWNERNM 1 and OWNERNM 2 attributes and double-click them in turn to add them to the editor window. In the editor window, click between the two attributes and press the spacebar to add a space character.

`@Value(OWNERNM1) @Value(OWNERNM2)`

You can either ignore the trailing space generated on records without a second owner (it won't affect the output's usefulness) or use a TrimRight function to remove it:

`@TrimRight(@Value(OWNERNM1) @Value(OWNERNM2))`

Click OK to close the editor dialog.
{% endstep %}

{% step %}

## Remove Attributes

Now that we have the Owners field, we can remove the attributes OWNERNM 1 and OWNERNM 2. However, the order of operations is now important. Owners MUST be created in the parameters dialog before OWNERNM1 and OWNERNM2 are removed.

To do so, click the newly created Owners field. Use the up-arrow button (^) on the dialog to move it up above OWNERNM1. Then remove OWNERNM1 and OWNERNM2.

The dialog will now look like this:

<figure><img src="/files/bsU8ba6lSAkpaYSQt6Jd" alt=""><figcaption></figcaption></figure>

Click OK to close the AttributeManager parameters.
{% endstep %}

{% step %}

## Run to the AttributeManager

It's about time to run the workspace to make sure everything we've done so far produces the correct result. Ensure feature caching is turned on, then run the workspace by clicking on the AttributeManager transformer and selecting Run to This:

<figure><img src="/files/Dk6jryfQeidnvnmJR1WG" alt=""><figcaption></figcaption></figure>

This will run the translation up to this transformer, but not writing any output (which we don't need yet). Inspect the AttributeManager:Output cache to confirm that the procedure worked as expected:

<figure><img src="/files/DsBkzuiXjduKovQ2famm" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

## Add an AttributeSplitter Transformer

Looking at the output schema there are two fields for Number and Street (for example "3305" and "W 10th Av"). However, the source schema condenses that information into one field with \<space> characters separating the fields ("3305 W 10th Av"). So to set the output attributes we need to split the single input field.

Insert an AttributeSplitter transformer. Insert it before the AttributeManager - then if there are any actions to carry out on the split attributes we can use the same AttributeManager transformer.

View the AttributeSplitter parameters. Set PSTLADDRESS as the attribute to split and **enter a whitespace character into the delimiter parameter**. Notice that a list name is set in the List Name parameter (we'll use that list shortly):

<figure><img src="/files/dNzPiXcMiEk5iFQHlGkq" alt=""><figcaption></figcaption></figure>

Click OK to close the dialog. If you run the workspace now and inspect the cache, you'll see the address as a list attribute in the Feature Information window:

\_list{0} (encoded: utf-8) 3305

\_list{1} (encoded: utf-8) W

\_list{2} (encoded: utf-8) 10th

\_list{3} (encoded: utf-8) Av

Remember a list attribute is one that can store multiple values under a single name (\_list).
{% endstep %}

{% step %}

## Copy List Attribute

Now let's handle the Number field in the output. Go back to the AttributeManager parameters.

Notice that there is now an entry for the list attribute called \_list{}. However, this is just the list attribute "*in general*", it isn't showing each element (value) in the list.

What we need to do is create a new attribute and copy the list element we want into it. So, in the Output Attribute field create a new attribute called Number by selecting it from the drop-down list.

For the Attribute Value field click the drop-down arrow and select Attribute Value > \_list{}.

You will now be prompted to select the element in the list. Ensure it is set to zero (0) and click OK.

<figure><img src="/files/RH5fvJge1xB1LfaNJcO2" alt=""><figcaption></figcaption></figure>

Click Apply/OK to confirm the changes. Run the workspace to the AttributeManager transformer and inspect the AttributeManager:Output cache to ensure the number is being copied.
{% endstep %}

{% step %}

## Construct Attribute

The final step is to recreate the Street attribute, without it being prefixed by the address number. One method would be to use the text editor to concatenate \_list{1}, \_list{2}, and \_list{3} just as we did with owner names. However, with lists we can use a special ListConcatenator transformer; it just needs a preliminary step.

So, open the AttributeManager parameters again. This time create a new attribute called \_list{0}, click the drop-down arrow for its value and select the option to set it to null:

<figure><img src="/files/aMfm4VZgTrlyIasER8nF" alt=""><figcaption></figcaption></figure>

This empties the first list element so that the rest can be easily concatenated together. To do so, place a ListConcatenator transformer after the AttributeManager.

Open the parameters dialog. Select \_list{} as the list to concatenate.\
**Set the Separator Character as a whitespace character.**\
Set the *Destination Attribute* to Street (to match the output schema), and set *Drop Empty and Null Elements* to Yes:

<figure><img src="/files/LT6KZMxDWIB0yETYXpWh" alt=""><figcaption></figcaption></figure>

Click OK to accept these changes and close the dialog. Run the workspace to this point and examine the output. You will find that we concatenated all parts of the street name back together.
{% endstep %}

{% step %}

## Set the Event Field

There's one final attribute to set. It could be done in the AttributeManager, but to demonstrate a different method, open the Feature Type dialog for the CSV writer.

Click on the User Attributes tab and set a fixed value for the Event field:

<figure><img src="/files/dIUDxBRD8ydF9PnTISbi" alt=""><figcaption></figcaption></figure>

Close the dialog and all output attributes should now be showing a green arrow, except for Event, which has a pink arrow to show it is being set in the feature type itself.
{% endstep %}

{% step %}

## Confirm Output Dataset

Save the workspace and then run it to create the output dataset.

Click on the PostalAddress writer feature type to open the popup menu then click on the View Written Data button to inspect the data in Data Preview. The output (in the Table View) should look like this:

<figure><img src="/files/CgYC1N9t7vKHaFfxgQck" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

***

{% hint style="success" %}
**CONGRATULATIONS**

*By completing this exercise, you have learned how to:*

* *Use the AttributeManager transformer to create, delete, rename, and sort attributes*
* *Use the Text Editor dialog to concatenate (and trim) attributes*
* *Use the AttributeSplitter to split attributes into a list attribute*
* *Handle list attributes in the AttributeManager*
* *Use the ListConcatenator transformer to concatenate elements of a list*
* *Use a Date/Time function in the AttributeManager text editor*
* *Use a feature type dialog to set an attribute value*
  {% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://1spatial.gitbook.io/fme-form-beginner/transformer-usage/managing-attributes/transformer-usage-exercise-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
