Skip to main content
Hi,

 

 

I am using FME Desktop 2013, Build 13448 to try and complete the following workflow.

 

 

Read in CSV's from a directory; as these have have differing numbers and names for attribute fields, before I complete the required processing. NOTE that all input files will have the 3 required I need even if they are named differently (extra fields can be ignored). I had planned to create a lookup.csv to manage the mappings and then use the schema mapper to read in the Survey CSV and the lookup csv and then create an output with only the 3 required fields with the new names. However, I must be doing something wrong as it is not working as imagined.

 

 

Input Survey examples:

 

 

File1 Schema

 

EAST,NORTH,HEIGHT

 

 

File2 Schema

 

easting,hei,Nothing,date,time

 

 

File3 Schema

 

X,Y,Z,Time

 

 

 

Lookup,csv

 

old,new

 

EAST,NEW_EASTING

 

easting,NEW_EASTING

 

X,NEW_EASTING

 

NORTH,NEW_NORTHING

 

Northing,NEW_NORTHING

 

Y,NEW_NORTHING

 

HEIGHT,NEW_HEIGHT

 

hei,NEW_HEIGHT

 

Z,NEW_HEIGHT

 

 

expected output

 

NEW_EASTING,NEW_NORTHING,NEW_HEIGHT

 

 

date, time and Time entries would be discarded.

 

 

 

I created the following

 

1. I have created my lookup table.csv containing field mappings

 

2. I have configured a CSV reader to read in survey files from a directory, identical schemas set to NO (single merged type)

 

3. I have hooked up a SchemaMapper straight after the CSV directory reader, I have also pointed it to the lookup csv. In the create actions dialog I have added an attribute map rule, source attribute field (old), destination attribute field (new)

 

 

However, the mapped output port does not rename the fields or remove the non required fields. Instead I have an additional _schemamapper_row_ids field populated with 1,2,3,.etc. based on the rows checked.

 

 

I have tried changing the additional options in the Attribute Map dialog e.g. default field value and source attribute keep/remove, but to no avail.

 

 

Have missed something obvious, if so what?

 

 

Looking online there appear to be various version of SchemaMapper with differing setups the one I am using is not the most current.

 

 

 

Regards,

 

 

Rob
Hi,

 

 

Your lookup uses duplicate mappings.

 

If u use attribute map, only the last gets mapped appearently. Yu can check this in the result with the _schemamapper_row_ids field.

 

 

I dont see any option to do "EAST" or "easting" or "X" Then "NEW_EASTING" (though i would expect a filter would/should be able to do that....)

 

 

I you use "new attribute" instead of "attribute map" with a tabel with no values, you get a table with the mappings.

 

Then u can use a attribute exploder so you have _att_name and _att_value. Where att_value contains the new attribute name.

 

 

 

(..or i am missing something too...;))
Hi Gio,

 

 

Thanks for the advice, I will give your method a try.

 

 

The Schema Mapper help was not overly clear, I presumed that because you could map many to 1 FeatureType names that  you would also be able to do the same with field headers.

 

 

Thanks again,

 

 

Rob

 


Hi Rob,

 

 

Actually i assumed the same as you did.

 

I spent some minutes before i understood why it did'nt work.

 

 


Reply