Skip to main content

Morning All,

Im trying to select the top two attribute names(calculated by largest values in attributes) of 6 attributes..

i have 6 attributes which contain a number (0-5), This number is then multiplied by a weighting (1-5)depending on the attribute. I do all this in an expression evaluator , ie attribute 1 x3, attribute 2x 5, attribute 3x 2, etc etc. My expression evaluator sums all these attributes to get a total score, excellent. I now need to know which 2 attributes (1-6 ) make up the largest portion of the total score.

I have tried with listPopulator for the 6 attributes, then a listsorter, then attributecreator (@Value(_list{0}),@Value(_list{1})). This however returns the original attribute value, not the attribute name..... Any help/suggestions appreciated. thanks steve

i guess an easier way to phrase the question is. say i have 3 attributes with int values. how do i get the name of the attribute with the largest int ? ie Attribute 1 = 3, Attribute 2 = 4, Attribute 3 = 0 , returns "Attribute 2". thanks again


Hi @goatboy, I created a custom transformer named "AttributeListExploder" to resolve the requirement similar to yours, and have published it in the FME Store. Try this one.

In the "Attributes" parameter, select six attributes storing their portion of the total score. This transformer creates a structured list - "_list{}.name", "_list{}.value", which stores pairs of selected attribute name and value.

Then, sort "_list{}.value" by numeric descending using the ListSorter. After that, "_list{0}.name" and "_list{1}.name" will store the required top two attribute names.


Hi @goatboy, I created a custom transformer named "AttributeListExploder" to resolve the requirement similar to yours, and have published it in the FME Store. Try this one.

In the "Attributes" parameter, select six attributes storing their portion of the total score. This transformer creates a structured list - "_list{}.name", "_list{}.value", which stores pairs of selected attribute name and value.

Then, sort "_list{}.value" by numeric descending using the ListSorter. After that, "_list{0}.name" and "_list{1}.name" will store the required top two attribute names.

The AttributeCreator can also be used to create a structured list that stores pairs of attribute name and value, but it would be troublesome to set parameters especially if the number of attributes is large. The AttributeListExploder just simplifies this.


Hi @goatboy, I created a custom transformer named "AttributeListExploder" to resolve the requirement similar to yours, and have published it in the FME Store. Try this one.

In the "Attributes" parameter, select six attributes storing their portion of the total score. This transformer creates a structured list - "_list{}.name", "_list{}.value", which stores pairs of selected attribute name and value.

Then, sort "_list{}.value" by numeric descending using the ListSorter. After that, "_list{0}.name" and "_list{1}.name" will store the required top two attribute names.

Many thanks @Takashi, As always, your a genius. Just what i was after. I really appreciate your help (on more than one occasion). Your a very valuable member of the worldwide FME family! thanks Steve


Reply