Skip to main content
Question

Conditionally join tables


Hi,

i have two tables, one containing a code list and the meaning of each code:

Code

 

Meaning

 

500

 

Grass

 

501

 

Tree

 

502

 

Street

 

 

The other table, coming from the land survey team, contains the coordinates and the code of the point.

X

 

Y

 

Code

 

51XXXXX1

 

9XXXXXXX1

 

501

 

51XXXXX2

 

9XXXXXXX2

 

500

 

51XXXXX3

 

9XXXXXXX3

 

500

 

 

I want the meaning of each code in this table is added in a new column:

X

 

Y

 

Code

 

Meaning

 

51XXXXX1

 

9XXXXXXX1

 

501

 

Tree

 

51XXXXX2

 

9XXXXXXX2

 

500

 

Grass

 

51XXXXX3

 

9XXXXXXX3

 

500

 

Grass

 

 

I m new to FME, usually i would do this with a script, e.g. in QGIS. My FeatureMerge options so far look like:

Any hints are welcome!

Thank you!

2 replies

danilo_fme
Evangelist
Forum|alt.badge.img+45
  • Evangelist
  • July 25, 2019

Hi @meyerlor

I used this configuration on transformer FeatureMerger:

The result:

 

Thanks,

Danilo


erik_jan
Contributor
Forum|alt.badge.img+18
  • Contributor
  • July 25, 2019

For FME 2018 and newer, you can use the FeatureJoiner instead of the FeatureMerger.

The FeatureJoiner is faster and more intuitive to use.

 

If both tables are in a database, I would use the SQLCreator and have the database execute the join.

The SQL would look something like:

Select survey.*, lookup.meaning

from survey, lookup

where survey.code = lookup.code;

 

Hope this helps.


Reply


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