Solved

Merge the primary dataset with the secondary dataset values, to show the primary dataset value merged with the values of each instance of the secondary dataset.

  • 11 August 2021
  • 2 replies
  • 1 view

Badge

Hi,

I am trying to merge two datasets, one being the primary dataset that has Levels and the second dataset that has Zones. Each level has all the zones associated to that the level. I would like to achieve a dataset that displays this merged dataset. I have created a small sample of the actual larger dataset below.

Levels and Zones FME DatasetI think the solution involves some sort of list handling but I have tried out several list transformers but so far haven’t been successful, I would like the desired outcome in columns as shown above and not in rows as I think can be achieved by exploding attributes. 

If this cannot be achieved using transformers, I am happy to use a python script inside the pythoncaller if someone doesn’t mind sharing a script.

Appreciate any advice either way.  Thanks in advance.

icon

Best answer by virtualcitymatt 11 August 2021, 20:41

View original

2 replies

Userlevel 4
Badge +26

Use an Aggregator to merge the secondary dataset into one (building a list out of the required attributes).

Next use a Feature Merger to join the aggregated feature (supplier) to the primary dataset(Requester) - use 1 = 1 in the feature merger.

This should give you the primary dataset each with a list attribute containing all​ secondary values.

Next use a ListExploder​, this should create a single feature for each element in the list.

Badge

Thank you @virtualcitymatt​ that suggestion worked a treat and I got the output I was looking for. I wasn’t aware that you could merge using the 1 = 1 in feature merger something I will have to look up and see what else I can merge beside the incoming attributes which I thought were obligatory. Thanks again. 

Reply