Skip to main content
Question

How can you combine attributes from various tables using an expression


marcyeranos
Contributor
Forum|alt.badge.img+1

Hello all, I frequently used the FeatureMerger or FeatureJoiner transformers. However, none of them seem to offer a join based on an expression, such as checking if a value from one table contains a value from another table. How can this be achieved? Thanks for any assistance.

4 replies

chrisatsafe
Contributor
Forum|alt.badge.img+2
  • Contributor
  • October 10, 2023

Hi @marcyeranos​ ,

 

You should be able to accomplish this by creating a new attribute (temporary join key) with Conditional Values. Using this approach, you will use an AttributeManager to first create a new attribute, then using Conditional values, define the expression based on any available attributes that you wish to join on.

 

image 

If you need to reference attribute values from the other table, you'll either need to merge all of the attributes so they are accessible while creating the conditional value statements, or you could simply use multiple FeatureJoiners as the "unjoined" ports would indicate no matching features exist for the current "join on" statement. In this case, you could connect both unjoined output ports to another FeatureJoiner with the next statement you wish to join on.


marcyeranos
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • November 3, 2023

Hi @chrisatsafe​ ​, Thank you for solution. Here's what I did guided by you: I assigned a unique key attribute to each table, setting id = 1 for instance. Then, I employed the "Full" option in the feature join, followed by the application of a tester transformer. In this tester, I set up a condition to check if the column value from one table is present in the column of the second table. And that did the trick! Much appreciated!


adnanyazdani
Contributor
Forum|alt.badge.img+2
  • Contributor
  • November 6, 2023
marcyeranos wrote:

Hi @chrisatsafe​ ​, Thank you for solution. Here's what I did guided by you: I assigned a unique key attribute to each table, setting id = 1 for instance. Then, I employed the "Full" option in the feature join, followed by the application of a tester transformer. In this tester, I set up a condition to check if the column value from one table is present in the column of the second table. And that did the trick! Much appreciated!

Is it possible share your Workspace template to test..?

 

Having similar kind of approach

 

Thanks


marcyeranos
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • November 6, 2023
adnanyazdani wrote:

Is it possible share your Workspace template to test..?

 

Having similar kind of approach

 

Thanks

Check Out the Custom Transformer I've Shared on the FME Hub! It's open to use. image


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