Skip to main content

I know there seems to be lots of topics around this but just can’t seem to get it to work.

I have a configuration file that I read in at the start of a workbench. In that file is a range of attributes that I turn into user parameters.

One of these is to define a specific field from a table which I have called _extractSubjectParcelQueryField

How do I use the contents of this variable to be the attribute that I want to expose?

 

 

In my case the actual value of the user parameter is ‘land_id’ but this can change depending on the data coming in.

 

 

I don’t think it is possible to dynamically expose attributes at runtime. But there are alternatives. What are you trying to achieve?


Thanks ​@nielsgerrits . I am trying to create a single workbench that can be run with different parameters depending on the database and fields in that database 


Can dynamic reading and dynamic writing help in this case? Can you elaborate more what your workspace should do?


Hi ​@deanhowell,

it could be quite tricky, but if you have succeded read your configuration file and given a value to the parameter _extractSubjectParcelQueryField, you may try the followig method (I don’t have access to FME at the moment, so I can’t try if it works):

  • start with a single feature (say from a Creator) and use ParameterFetcher to expose the value into an attribute;
  • use an AttributeCreator to create the new attribute with its related value (will be hidden);
  • use an AttributeExploder to explode all attributes in (name, value) pairs (you will end up with some features, one for each attribute, including the hidden one);
  • filter out unwanted features from the output of the AttributeExploder so as to get only one (name, value) pair, using, for example, a Tester.

You should end up with a single feature with the contents you want in the value attribute (no matter the contents of the name attribute). From this you can create a new attribute, with whatever name you want, to use its value.

Hope that helps!


Thanks ​@nielsgerrits I am creating a workspace runner workbench where it will initially gather all the user parameters from a configuration file, although may move this to a database table. Once the parameters are loaded different workbenches are called. One extracts data from a defines database and table based on a query, as per my screenshots and then other workbenches validate and report on the data. I am trying to future-proof and make the workbenches easier to maintain so that if key elements change i.e. database connection, layer names, queries, etc can put in the configuration table and the workbenches should still run.

Thanks also ​@davtorgh I will give your process a go and see if I can get something to give me the relevant info.  


Reply