Skip to main content
Question

Define Categories based on values

  • April 17, 2025
  • 3 replies
  • 76 views

katt
Supporter
Forum|alt.badge.img+12

Hello, I have a table with 3 records per house. The table includes hundreds of houses. I want to create a new attribute called Type. There are two types only : A and B.

For Type A: two values of attribute a1 per house equal the value of attribute a2 of another record of the same house.

For Type B: two values of attribute a2 per house equal the value of attribute a1 of another record of the same house.

How can I automatically assign the type to each record of any given house? Thx. 

 

3 replies

crutledge
Influencer
Forum|alt.badge.img+43
  • Influencer
  • April 17, 2025

Hi ​@katt 
Could you count the number of times a record occurs per house in a1 and a2 then if a1_count = 2 then Type A and if a2_count = 2 then Type B?
 

 


geomancer
Evangelist
Forum|alt.badge.img+59
  • Evangelist
  • April 17, 2025

You give a nice example, because just counting the number of times a record occurs per house in a1 and a2 does not work. House x has 2 occurences of 12 in a1, and 2 occurences of 10 in a2. But the value 10 is not present in a1.

Calculate the Histogram in a StatisticsCalculator, then determine the Type. See the attached example (FME 2024.1).

 


takashi
Celebrity
  • April 17, 2025

Count the number of features having the same value in a1 and a2 for each House, then determine Type of House according to the criteria:

If count of a1 = 2 AND count of a2 = 1 Then A
Else if count of a1 = 1 AND count of a2 = 2 Then B 

See also the attached workspace example.