I have created a crosswalk from multiple shapefiles that a) reads a look up table b)writes the values to a geodatabase and c)populates a field called "DataSource" with the source shapefile names. I have a field called "city" that needs to have city values populated based on the value in the "DataSource" field. My approach was to set a condition statement in the target field properties of the writer using If/Else If/Else statements. Didn't work. Please see screen caps showing parameters and desired outcome.
I have never tried to do this from the writer but your approach will work if you follow the same process using the attributecreator or attributemanager
Hi @daveyourguide, I think conditional value setting for user attributes in a writer feature type should work as expected (at least in FME 2016.1.3). Make sure that the attribute names and values written in the Test Condition column are exactly match ones that the features could have. Note that FME identifies attribute names and values with case-sensitive. e.g. "dataSource" as an attribute name will be distinguished from "DataSource".
However, I think it would be better to create a new attribute called "city" with a transformer beforehand, from the point of view for better maintainability of the workspace. As @ciarab mentioned, you can create a new attribute with conditional value setting using the AttributeCreator or the AttributeManager. Alternatively, you can also use the AttributeValueMapper in this case.
Hi @daveyourguide, I think conditional value setting for user attributes in a writer feature type should work as expected (at least in FME 2016.1.3). Make sure that the attribute names and values written in the Test Condition column are exactly match ones that the features could have. Note that FME identifies attribute names and values with case-sensitive. e.g. "dataSource" as an attribute name will be distinguished from "DataSource".
However, I think it would be better to create a new attribute called "city" with a transformer beforehand, from the point of view for better maintainability of the workspace. As @ciarab mentioned, you can create a new attribute with conditional value setting using the AttributeCreator or the AttributeManager. Alternatively, you can also use the AttributeValueMapper in this case.
Thanks
Thanks
- The 'city' field should have been defined in the feature class schema. If the 'city' field has not exist yet, you have to add the field definition to the feature class with an appropriate tool, such as ArcCatalog.
- Then, set 'Update' to the Feature Operation parameter. Alternatively you can set 'fme_db_operation' to the parameter like your screenshot. However, if you do so, you will have to add the 'fme_db_operation' attribute storing 'UPDATE' as its value to every feature before writing.
- And you should set only unique ID attribute(s) to the Match Columns parameter. If you read existing records and just update them, the 'OBJECTID' could be used as the unique ID for the records.
- The 'city' field should have been defined in the feature class schema. If the 'city' field has not exist yet, you have to add the field definition to the feature class with an appropriate tool, such as ArcCatalog.
- Then, set 'Update' to the Feature Operation parameter. Alternatively you can set 'fme_db_operation' to the parameter like your screenshot. However, if you do so, you will have to add the 'fme_db_operation' attribute storing 'UPDATE' as its value to every feature before writing.
- And you should set only unique ID attribute(s) to the Match Columns parameter. If you read existing records and just update them, the 'OBJECTID' could be used as the unique ID for the records.
Hello @takashi,
I've tried everything that I can. I am working with a file gdb that contains both the source and destination fields. Therefore the reader points to the source field (sourceData) and the writer points to the destination (city). Every attempt runs successfully but does not write the value translation to the destination field.
I have attached the file gdb with a sample of the record that meet the conditions. I have also attached the FME workspace. Both are in the attached .zip. I hate to trouble you but if you can have a look it would probably save some time trying to explain what I have attempted. Thank you!testfme.zip
Thanks
Why not set only 'OBJECTID' to the Match Columns parameter?
Why not set only 'OBJECTID' to the Match Columns parameter?
I have never tried to do this from the writer but your approach will work if you follow the same process using the attributecreator or attributemanager