Question

Conditionally join tables

  • 25 July 2019
  • 2 replies
  • 24 views

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

Userlevel 5
Badge +30

Hi @meyerlor

I used this configuration on transformer FeatureMerger:

The result:

 

Thanks,

Danilo

Userlevel 2
Badge +16

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