Skip to main content

Hi all. I ran multiple spatial filters to identify intersects between two layers, and now have around 70 attributes (custom named to the name of the layer, rather than the default name), that contain either INTERSECTS or Null. I want to now replace all INTERSECTS with the name of the attribute, using String Replacer or the like. What is the best way to do this? I have attached an example screenshot below of what I have vs. what I want to do. Thanks!

 

image

Use SchemaScanner to get attribute names in attribute{}.name list on the <Schema> output port.

FeatureMerger, Output port of SchemaScanner to Requestor, <Schema> port of SchemaScanner to Supplier, join on fme_feature_type_name to merge the attribute{}.name list to the original features.

AttributeManager with Set Conditional Value on initial attributes, test if Attribute Has a Value (or if it is equal to INTERSECTS) and set attribute value to the corresponding list element from attribute{}.name.

I have attached a sample workspace to use as a starting point.


@rhysdixon8​  the solution above using the attribute{}.name works well, but might get bit tedious if you have 70 attributes. @Takashi Iijima​ often has a good solution using the NullValueMapper for these types of problems but I couldn't see that here.

PythonCaller and a short python script might help: see the attached example workspace (FME 2021.2)


Reply