Skip to main content
Solved

max attribute value name

  • April 3, 2016
  • 4 replies
  • 20 views

Forum|alt.badge.img

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

Best answer by takashi

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

Forum|alt.badge.img
  • Author
  • April 4, 2016

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


takashi
Celebrity
  • Best Answer
  • April 4, 2016

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.


takashi
Celebrity
  • April 4, 2016

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.


Forum|alt.badge.img
  • Author
  • April 4, 2016

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