Skip to main content
Solved

How to group accross multiple column entries?

  • August 3, 2023
  • 8 replies
  • 68 views

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 

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.

8 replies

saraatsafe
Safer
Forum|alt.badge.img+11
  • Safer
  • 147 replies
  • 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
  • 4 replies
  • 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+11
  • Safer
  • 147 replies
  • 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...

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
  • 4 replies
  • 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+56
  • Safer
  • 2554 replies
  • August 14, 2023

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
  • 4 replies
  • August 16, 2023

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


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

The custom transformer ListCombiner can be used here

image 


  • Author
  • 4 replies
  • August 16, 2023

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