Solved

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

  • 27 October 2022
  • 2 replies
  • 1 view

Badge +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

icon

Best answer by dhaulagiri 14 November 2022, 10:18

View original

2 replies

Userlevel 4
Badge +26

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.

Badge +4

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