Skip to main content

I am getting features in through a WFS and pump the resulting XML structures through an XMLFlattener.

The Elements to Match are ‘grouped’ by an attribute value and thereby dynamic.

What I cannot make dynamic are the Attributes to Expose. I can either write them myself, or import them, but how can I get e.g. a list to work there, or the value of an attribute?

Best thing would be the option of a conditional value… 😉

I don't think dynamically exposing attributes like that is possible. There are a lot of threads asking this, and a few workarounds for specific scenarios have been found, do you need the attributes in your canvas or do you just need to write them?


Hi @joepk I only need to write them. The issue is that there are more than 80 different elements to match , and each comes with its own set of attributes I have to expose. I don’t mind preparing the different lists, it needs to be done anyway, but having 80 XMLFlatteners in my workspace… not exactly how I imagined.


If you only have to read and write the features you do not have to expose the attributes. Unexposed attributes are still there when you write them using a dynamic writer. This article could help you set up a dynamic writer, or this tutorial, or maybe this documentation of the SchemaScanner


My workspace already uses a SchemaScanner and a dynamic Writer. The attributes I have to expose are not all of the attributes per element, but just a subset. Many of the attributes that come with the elements are of no interest to me, and I would like to get rid of them as fast as possible. For sure I do not want to write them out.


Ah so you want to keep a certain set of attributes which changes depending on the element that is matched.

I would consider using a separate WorkspaceRunner to create a string of attributes you want to keep (assuming you have these lists somewhere), and pass that string onto your actual analysis workspace as a User Parameter, where the User Parameter can be used in an AttributeKeeper, removing all other attributes. 


Took me a while but I found the BulkAttributeKeeper, a community transformer at FME Hub.

This one allows directly what I need through regex.

 


Reply