3

I am new to FME but used to ArcGIS ModelBuilder.

I am trying to figure out how to select rows based on an attribute and then change the values in the selected rows by a simple formula in FME.

The ModelBuilder model is

enter image description here

and code exported from it is

# Process: Select Layer By Attribute
arcpy.SelectLayerByAttribute_management(Properties_shp__2_, "NEW_SELECTION", "\"Property_A\" = ' '")

# Process: Calculate Field
arcpy.CalculateField_management(Properties_shp__3_, "Property_A", "[Property_N]", "VB", "")

This should be the first step in my FMW that then processes it

enter image description here

3

The first thing you need to understand is that despite the similarity between how they look, FME is not ModelBuilder. In FME, you don't select features they way you do in ArcGIS. The way to achieve what you want is by using a Tester to filter out the features you want to update. Then follow that with an ExpressionEvaluator transformer.

enter image description here

In the tester, you can set the expression that you want to test. In this case, I tested for when the PROPERTY_A field had a space for a value.

enter image description here

Note, in the operator drop down, you can test for other types of empty strings or null strings, etc.

enter image description here

In the ExpressionEvaluator, you can set the value for the attribute that passed the test. In this case, I set it to the value of the PROPERTY_N field.

enter image description here

I noticed that you have a FeatureWriter transformer which means you're using FME 2016. You can do all of the above in one transformer which is available in 2016, the AttributeManager. That is, replace the tester and expression evaluator with just the single AttributeManager.

enter image description here

Notice how I have "two possible values" for PROPERTY_A? In the drop down, there is an option for Conditional Value:

enter image description here

You'll be presented with an If/Else window for the condition statement. Click the If field.

This looks identical to the Tester transformer! Use the same test that you used before but this time, at the bottom, set your output value to PROPERTY_N.

enter image description here

Your final condition statement will look something like this:

enter image description here

So, what this will do is test if the PROPERTY_A field has a space for a value and set it to PROPERTY_N. Otherwise, it'll leave it as it was (Do Nothing).

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.