Skip to main content

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?

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!


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...


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!


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


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.


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


The custom transformer ListCombiner can be used here

image 


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


Reply