Skip to main content
Question

How to extract all unique combinations?

  • November 11, 2020
  • 4 replies
  • 71 views

I'm trying to extract all unique combinations of a given datamodel. 

 

For example:

Table 1.

FRUIT	COLOR	TYPE
Apple Green Kanzi
Yellow Jonagold
Red Elstar
Golden Fuji
Pink Golden Delicious
Royal Gala

With this given datamodel, I can make 30 unique combinations.

Like this:

Table 2.

FRUIT	COLOR	TYPE
Apple Green Kanzi
Apple Green Jonagold
Apple Green Elstar
Apple Green Fuji
Apple Green Golden Delicious
Apple Green Royal Gala
Apple Yellow Kanzi
Apple Yellow Jonagold
Apple Yellow Elstar
Apple Yellow Fuji
Apple Yellow Golden Delicious
Apple Yellow Royal Gala
Apple Red Kanzi
Apple Red Jonagold
Apple Red Elstar
Apple Red Fuji
Apple Red Golden Delicious
Apple Red Royal Gala
Apple Golden Kanzi
Apple Golden Jonagold
Apple Golden Elstar
Apple Golden Fuji
Apple Golden Golden Delicious
Apple Golden Royal Gala
Apple Pink Kanzi
Apple Pink Jonagold
Apple Pink Elstar
Apple Pink Fuji
Apple Pink Golden Delicious
Apple Pink Royal Gala

I made table 2 in excel with copy and pasting. The real dataset that I have has alot more columns and values. Therefore I would like to automate this proces in FME.

 

How can I transform table 1 to table 2?

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.

4 replies

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • November 11, 2020

Whilst it's probably possible to do this in FME with your example, I'm not sure it would scale up very well. You might be able to do something with the inline querier, itertools in a pythoncaller is probably the way to go though


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • November 11, 2020

A simple example based on your sample input

 Capture


  • Author
  • 1 reply
  • November 12, 2020

A simple example based on your sample input

 Capture

Amazing, will try this out! Thanks alot!


Forum|alt.badge.img+2
  • 1891 replies
  • November 12, 2020

@wereldbol​  if, like me, you're not a strong python developer, you should be able to accomplish thi with a couple of FeatureJoiners. Not nearly as elegant or flexible as @ebygomm​ 's python.