Solved

Can you get a list of attribute values in transformer (eg Tester)?


Badge +4

Hi

I am trying to filter a dataset to show a features that are in set of values . I am using the Tester transformer with the IN operator. If I were to do this in an ESRI product, I could select the field (attribute) I want to filter and it would list all the unique values for that field to enable me to chose the ones I require. However, I cant see a way to get that info in FME - I have to stick in another transformer and inspector and then copy and paste the values I want into the expression, which is far from an ideal workflow.

Please could someone tell me if there is an easier way to do what I want to do? Many thanks

icon

Best answer by fmelizard 8 July 2020, 23:24

View original

6 replies

Userlevel 5
Badge +25

Unfortunately that's pretty much the way to do it.

To get a list of unique values for an attribute you can use a Sampler, set to group by that attribute, and only pass every 1st feature, or an InlineQuerier with a SELECT DISTINCT [attribute] FROM [feature type] query. Obviously that's only the unique values that are in the dataset now, since FME is mainly for building repeatable processes you don't know what's going to be in there in the future.

Badge +4

That's such a shame - I thought it was just me not knowing how to do it. In my opinion, its a massive, massive oversight of the developers part

Userlevel 5
Badge +25

Depending on what you want to do there may be other options. If you're going to be filtering on attributes that are present in the source data (instead of ones being created/altered during the course of your workspace) the AttributeFilter has an option to import existing values.

Badge +4

Unfortunately not in source data, but I guess I could write it out first.

Basically, I have used the attribute exploder and need to remove a lot of the attributes that have been exploded - I really don't want all the format attributes to be in there. I have removed the un-needed user attribute with an attribute manager before the exploder

Userlevel 4
Badge +13

Hi @markcoopersdc An enhancement to the Tester and TestFilter to see a list of values is actually on its way in the next few days. You're welcome to register for tomorrow's webinar to learn more.

Userlevel 4
Badge +13

That's such a shame - I thought it was just me not knowing how to do it. In my opinion, its a massive, massive oversight of the developers part

Hi Mark, As @danatsafe hinted, we're releasing the first step towards what you're asking in just a few hours. In fact, I'm just putting the finishing touches on the demo. The architecture of FME is such that, for the past 25+ years, the "design time" is different than the "run time" -- at design time, we didn't know the data's contents, just its structure (or schema). Only at run time does the data flow through. Lots of good benefits from this choice, but the big big downside is that you don't know what the values are when you're designing. And so you get the issue you hit (among others). Our "feature cache" mode of authoring, where we keep copies of the data at each step as you are designing, only recently came out and that is the springboard upon which capabilities like you're asking here can be built. Tomorrow we can't solve exactly your use case, but it was already on the near term roadmap prior to your question. Thanks for your patience while we get there...

Reply