Question

How would I Extract a dominant value from multiple fields, and associate the dominant value with another value from a corresponding field?

  • 8 April 2022
  • 3 replies
  • 12 views

I am currently trying to extract the dominant value from a given row and populate a field with the dominant value from one of the dominant fields while associating it to another value in another field.

 

This is how to interpret the table in general.

AreaCount1 is the count for area one in AreaName1 field.

AreaCount2 is the count for area two in AreaName2 field.

so... on and so forth.

 

For example:

For UniqueID 10 the dominant attribute from the six AreaCount columns is 1736 (see image below). I am able to extract the dominant value by creating a new DominantValue field and applying this math function @max(@Value(AreaCount1),@Value(AreaCount2),@Value(AreaCount3),@Value(AreaCount4),@Value(AreaCount5),@Value(AreaCount6)).

 

 

ExtractingDominantValue_1The math fucntion provides me with 1736 as the dominant value from AreaCount3 (highlighted in the image above). Now... I am trying to associate the dominant value with the AreaName that it is associated with. So for UniqueID 10 that has a dominant value of 1736 the dominant area is "area three" that is found within the AreaName3 field.

 

I am aware that I will run into dilemmas with fields that have the same value for dominant value. But for now... Does anyone have any recommendations as to how to extract the dominant value, and relate the dominant value to another attribute in another field (in this case its the values in the AreaName fields from the above image).

 


3 replies

Userlevel 2
Badge +17

Hi @enriquep​ , if I understand your requirement correctly, a possible way is:

ListPopulator x 2: Populate values of AreaCount1-6, values of AreaName1-6 into two list attributes (e.g. called "_count{}" and "_area{}").

ListRangeExtractor: Extract the max value (i.e. DominantValue) from the "_count{}" list.

ListSearcher: Find index of the element in the "_count{}" list, which matches DominantValue.

ListIndexcer: Extarct desired area name from the "_area{}" list, acoording to the element index found by the previous ListSearcher.

AttributeManager: Rename, reorder, delete attributes, if necessary.

 

The attached screenshot illustrates my intention.workflow-example

Userlevel 2
Badge +17

Hi @enriquep​ , if I understand your requirement correctly, a possible way is:

ListPopulator x 2: Populate values of AreaCount1-6, values of AreaName1-6 into two list attributes (e.g. called "_count{}" and "_area{}").

ListRangeExtractor: Extract the max value (i.e. DominantValue) from the "_count{}" list.

ListSearcher: Find index of the element in the "_count{}" list, which matches DominantValue.

ListIndexcer: Extarct desired area name from the "_area{}" list, acoording to the element index found by the previous ListSearcher.

AttributeManager: Rename, reorder, delete attributes, if necessary.

 

The attached screenshot illustrates my intention.workflow-example

A different approach. JSON operations could also be effective in this case.workflow-example-2

Hi @enriquep​ , if I understand your requirement correctly, a possible way is:

ListPopulator x 2: Populate values of AreaCount1-6, values of AreaName1-6 into two list attributes (e.g. called "_count{}" and "_area{}").

ListRangeExtractor: Extract the max value (i.e. DominantValue) from the "_count{}" list.

ListSearcher: Find index of the element in the "_count{}" list, which matches DominantValue.

ListIndexcer: Extarct desired area name from the "_area{}" list, acoording to the element index found by the previous ListSearcher.

AttributeManager: Rename, reorder, delete attributes, if necessary.

 

The attached screenshot illustrates my intention.workflow-example

Thank you @Takashi Iijima​ for providing both of these workflows. I went with the first workflow, and managed to get the desired output.

Reply