Skip to main content
Solved

How to filter data in FME using an attribute from another port?


jugoslaviaa
Enthusiast
Forum|alt.badge.img+6

Hi everyone,

I’m working on an FME workspace where I have two input ports:

  • One port brings in the main data (features).

  • The second port provides attribute values from an Excel file, which I want to use to filter the data from port one.

And here you can see how the data from port one looks:

Here is what the Excel file looks like:

 

I’m basically trying to filter the data (output of AttributeRemover_6, see first image) where:

  • destination_class_source = StructureBoundary AND  assetgroup.description = InstallationBoundary AND assettype.description = CabinetBoundary and cus_cstype_id = 2
  • destination_class_source = StructureBoundary AND  assetgroup.description = InstallationBoundary AND assettype.description = CabinetBoundary and cus_cstype_id = 9
  • destination_class_source = StructureBoundary AND  assetgroup.description = InstallationBoundary AND assettype.description = CabinetBoundary and cus_cstype_id = 3

 

The filter information comes from the Excel file (second image). 

 

What would be the best way to filter the main data based on this attribute coming from the second port?

Thanks in advance!

Best answer by takashi

OK. If I understand the requirement correctly, this procedure could help you.

  1. Merge the Excel features to the main features with FeatureJoiner.
Left Right
destination_class CLASS
assetgroup.description ASSETGROUP
assettype.descriptioni ASSETTYPE
  1. Filter the joined features with this test clause set in a Tester.

@Value(@Value(CLASS_FILTER_FIELD)) = @Value(CLASS_FILTER_VALUE)

 

View original
Did this help you find an answer to your question?

15 replies

takashi
Influencer
  • June 5, 2025

Hi ​@jugoslaviaa ,

Not clear the situation, could you please clarify where 'CLASS_FILTER_FIELD' and 'CLASS_FILTER_VALUE' shown in your screenshot come from?


jugoslaviaa
Enthusiast
Forum|alt.badge.img+6
  • Author
  • Enthusiast
  • June 6, 2025

Hi ​@takashi 

These attributes come from an Excel file that I am reading. CLASS, ASSETGROUP, and ASSETTYPE exist in my main data as part of the cus_cstype_id attribute; however, it is not exposed. 


jugoslaviaa
Enthusiast
Forum|alt.badge.img+6
  • Author
  • Enthusiast
  • June 6, 2025

@takashi My idea was to use a FeatureJoiner and join on CLASS, ASSETGROUP, and ASSETTYPE, and then try to use the exposed @Value(CLASS_FILTER_FIELD)—because I saw that in a community answer for a different question.
However, it didn’t work.

 


raghavendrans
Enthusiast
Forum|alt.badge.img+14

@jugoslaviaa

From your email I am not sure if my understanding is correct, which is as below:

You are joining or merging two datasets (which is what you mean by one port brings the  main features and the second port brings the cus_cstype_id).

My conclusion is after the merge, your output features should contain class, assetgroup, assettype and cus_cstype_id attributes for the features that are output from the JOINED port of the FeatureJoiner, provided the settings in your FeatureJoiner are properly set.

Let me know if this is case and then I can assist you further.

Happy FME:-) ing

Cheers

SRG


takashi
Influencer
  • June 6, 2025

According to your screenshot, @Value(CLASS_FILTER_FIELD) returns the string ‘cus_cstype_id’, won’t return the value of attribute called ‘cus_cstype_id’. 

If the feature has unexposed attribute named ‘cus_cstype_id’ and you want to retrieve its value, @Value(@Value(CLASS_FILTER_FIELD)) will return your required value.

@Value(@Value(CLASS_FILTER_FIELD)) returns the same value of @Value(cus_cstype_id), if the value of CLASS_FILTER_FILED was ‘cus_cstype_id’ - the case of your screenshot.


jugoslaviaa
Enthusiast
Forum|alt.badge.img+6
  • Author
  • Enthusiast
  • June 6, 2025

@takashi ​@raghavendrans 
I added further explanation and image how my data looks like where i  try join the excel or filter. 

 

The problem is i have to first use the value of CLASS_FILTER_FILED  which is cus_cstype_id to expose a future in another dataset. 


jugoslaviaa
Enthusiast
Forum|alt.badge.img+6
  • Author
  • Enthusiast
  • June 6, 2025

@takashi I join the dataset with FeatureJoiner and the parameter looks like this 
 

With these my data get the CLASS_FILTER_FILED  and tried 3 methods to compare and see if the expose works and noone of them works. 


 

 


takashi
Influencer
  • June 6, 2025

I think I have almost understood the situation, but I have one more question. Is the value of CLASS_FILTER_FIELD always 'cus_cstype_id', or could it be vary?

 

[Addition]

The values returned from @Value(@Value(CLASS_FIELD_VALUE)) and @Value(CLASS_FIELD_VALUE) can be assigned to new attributes with AttributeManager or AttributeCreator, could not be attribute names which will be exposed with AttributeExposer.


jugoslaviaa
Enthusiast
Forum|alt.badge.img+6
  • Author
  • Enthusiast
  • June 6, 2025

Unfortunately not always  'cus_cstype_id' it may be vary 


takashi
Influencer
  • Best Answer
  • June 6, 2025

OK. If I understand the requirement correctly, this procedure could help you.

  1. Merge the Excel features to the main features with FeatureJoiner.
Left Right
destination_class CLASS
assetgroup.description ASSETGROUP
assettype.descriptioni ASSETTYPE
  1. Filter the joined features with this test clause set in a Tester.

@Value(@Value(CLASS_FILTER_FIELD)) = @Value(CLASS_FILTER_VALUE)

 


jugoslaviaa
Enthusiast
Forum|alt.badge.img+6
  • Author
  • Enthusiast
  • June 6, 2025

@takashi all the objects are failing because @Value(@Value(CLASS_FILTER_FIELD))  is not exposed. See my screen shot above. I tried all 3 variation and none of them return any values

 


takashi
Influencer
  • June 6, 2025

You don’t need to expose any attributes. Have you configured the workflow as I suggested?

 


jugoslaviaa
Enthusiast
Forum|alt.badge.img+6
  • Author
  • Enthusiast
  • June 6, 2025

@takashi yes, i think so

 


takashi
Influencer
  • June 6, 2025

It seems that @ at the head of the expression is missing.

@Value(@Value(CLASS_FILTER_FIELD))

 


jugoslaviaa
Enthusiast
Forum|alt.badge.img+6
  • Author
  • Enthusiast
  • June 6, 2025

@takashi Very embarrassing! It works!
You can actually access the attribute with the Tester even if it’s not exposed?
Thanks a ton!


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