Skip to main content
Solved

How to group accross multiple column entries?


Hi everyone!

I'm new to FME and I have a question on how to group entries of a table based on two columns. This is the table:imageNow I want a new column with the group ID. It should look like this:

imageExplanation:

  • If the fruit is the same, they should belong to the same group --> Apples are in group 1.
  • If the Buyer of group 1 also buys other fruits, then these fruits should also belong to group 1. -->Anna also buys Bananas, therefore Bananas belong to group 1

 

I tried different transformers, but did not find a solution. Can someone help?

Best answer by ebygomm

The custom transformer ListCombiner can be used here

image 

View original
Did this help you find an answer to your question?

8 replies

saraatsafe
Safer
Forum|alt.badge.img+10
  • Safer
  • August 3, 2023

Hi @sputniktwo​, please take a look at the attached workspace which first lists out all the prior Fruits and Buyers. It then compares the latest entry to this list and see if it should join that group. I hope this helps and please let us know if you have any questions!


  • Author
  • August 4, 2023

Thank you @saraatsafe​ , that's almost what I want. However there is still a problem if I use a more complex table. I guess the problem is, that with your solution it's only looking at 1 prior feature...


saraatsafe
Safer
Forum|alt.badge.img+10
  • Safer
  • August 4, 2023
sputniktwo wrote:

Thank you @saraatsafe​ , that's almost what I want. However there is still a problem if I use a more complex table. I guess the problem is, that with your solution it's only looking at 1 prior feature...

Hi @sputniktwo​, yes, so in that workspace technically only the prior feature is being looked at, however it does take all prior features into account because the prior feature is cumulative (it lists out all of the previous features and uses that to compare against the latest feature). I hope this helps!


  • Author
  • August 7, 2023

thanks! I still have the issue, that the groups in my second example are not correct...


mark2atsafe
Safer
Forum|alt.badge.img+44
  • Safer
  • August 14, 2023
sputniktwo wrote:

thanks! I still have the issue, that the groups in my second example are not correct...

Can you provide some data for this? I looked at the Fruity file but I don't think the data is included.


  • Author
  • August 16, 2023

Hi @mark2atsafe​ thanks for looking into my problem! Here is the excel :)


ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • Best Answer
  • August 16, 2023

The custom transformer ListCombiner can be used here

image 


  • Author
  • August 16, 2023

You saved my day - such a short solution! Hugs thanks!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings