The Multiple Feature Attribute Support functionality has been added to the AttributeCreator in FME 2013 SP2, it realizes accessing freely to attributes of backward / forward features in a sequence of features. Using this functionality, for example, the Fibonacci sequence can be created easily by a Counter and an AttributeCreator with the settings like:
Counter
Count Output Attribute: _fibonacci
Count Start: 0
AttributeCreator
<Mutliple Feature Attribute Support>
Number of Prior Features: 2
<Attribute To Set>
Attribute Name: _fibonacci
Value (Conditional):
Test Condition: 1 < @Value(feature[0]._fibonacci)
Output Value: @Evaluate(@Value(feature[-2]._fibonacci)+@Value(feature[-1]._fibonacci))
After this, using an AttributeAccumulator and a ListConcatenator, got a correct Fibonacci sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...
The point is that we can access any attributes of prior / subsequent features with the syntax of feature[n].<attribute name>. n is an integer value which indicates the relative position of a feature based on the position of the current feature in the sequence. Negative n means a prior feature, positive n means a subsequent feature, and naturally 0 means the current feature. The range of available n value will be determined according to "Number of Prior Features" and "Number of Subsequent Features" parameters.
Does the Fibonacci sequence seem useless?
OK, see:
Great! Multiple Feature Attribute Support in AttributeCreator FME 2013 SP2
2013-08-26
In FME 2013 SP3, we don't need to use the syntax of feature[0].<attribute name> for the current feature attribute. Just <attribute name> indicates the current feature attribute in condition expressions. For example:
Test Condition: 1 < @Value(_fibonacci)
Next: Use Case of Multiple Feature Attribute Support
No comments:
Post a Comment