Skip to main content
Solved

How to use a value/list as parameter in a dynamic workflow?


dhaulagiri
Contributor
Forum|alt.badge.img+4

Hello, I created a dynamic workflow to load geopackages into as many tables of a PostGIS database From a SchemaScanner, I retrieve the source schemas then I build the names of the destination tables and I make some modifications to the data types. For example, boolean attributes are not recognized by FME because the values ​​are not conforming. So I would like to replace all non conforming values ​​of these attributes. In the schema part of the processing, I retrieved all the boolean attributes (in a list or a concatenated string). I would now like to use this as a parameter to define in the features part of the processing the attributes whose boolean values ​​must be corrected (StringReplacer for example). I could manually select these attributes but I would lose the interest of the dynamic workflow. I don't know how to do it automatically. Does anyone know how to do this?Capture

Best answer by dhaulagiri

Hi,

Thank you.

I finally found a solution.

From a "SchemaScanner":

- in the first Schema branch, a "ListExploder" retrieves all the attributes, an "AttributeManager" modifies the types, a "Tester" extracts the booleans, a "DuplicateFilter" removes the duplicates if an attribute is present in several datasets

- in the second "Output" branch, a "Counter" assigns an id to each entity, a "GeometryExtractor" stores the geometry in a binary and deletes it, an "AttributeExploder" creates attribute-value pairs

Each branch then enters a "FeatureMerger": if the attribute name (_attr_name) of the "Ouput" branch finds a match in the list of boolean attributes (name), then the value of this attribute (_attr_value) is updated in an "AttributeManager" and an "AttributeCreator" creates @Value(_attr_name) = _attr_value. Then, the original entities are reconstituted with an "Aggregator" (Group By on the id of the "Counter") and a "GeometryReplacer".

Ungrouping entities can be very resource intensive: I had to test with a reduced number of entities by activating caching. In production, it is disabled.

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

2 replies

virtualcitymatt
Celebrity
Forum|alt.badge.img+39

Yeah you can't expose attributes in a dynamic fashion like this.

You could check out a NullAttributeMapper. This should be able to do what you want. It's nice because it has the option to perform the replace on ALL attributes - the replacement on ALL attribute might not be desired I guess.


dhaulagiri
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • Best Answer
  • November 14, 2022

Hi,

Thank you.

I finally found a solution.

From a "SchemaScanner":

- in the first Schema branch, a "ListExploder" retrieves all the attributes, an "AttributeManager" modifies the types, a "Tester" extracts the booleans, a "DuplicateFilter" removes the duplicates if an attribute is present in several datasets

- in the second "Output" branch, a "Counter" assigns an id to each entity, a "GeometryExtractor" stores the geometry in a binary and deletes it, an "AttributeExploder" creates attribute-value pairs

Each branch then enters a "FeatureMerger": if the attribute name (_attr_name) of the "Ouput" branch finds a match in the list of boolean attributes (name), then the value of this attribute (_attr_value) is updated in an "AttributeManager" and an "AttributeCreator" creates @Value(_attr_name) = _attr_value. Then, the original entities are reconstituted with an "Aggregator" (Group By on the id of the "Counter") and a "GeometryReplacer".

Ungrouping entities can be very resource intensive: I had to test with a reduced number of entities by activating caching. In production, it is disabled.


Reply


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