Solved

BulkAttributeRenamer in Dynamic Workflow: no features and attribute names did not change

  • 25 September 2018
  • 14 replies
  • 8 views

Badge +2

FME Desktop 2017.1 build17725

When I create a simple Dynamic Workflow from shape to shape, everything works fine.

When I put the BulkAttributeRenamer to the Workspace, the results are weird.

I like to have all attribute names lowercase.

Instead, attribute names remain capital, but all my data is lost in the output...

Is that a known issue?

icon

Best answer by redgeographics 25 September 2018, 19:43

View original

14 replies

Badge +21

Perhaps this is the solution? : https://knowledge.safe.com/questions/2168/shapefile-fieldnames-always-uppercase.html

Badge +2
Thank you Sigbjørn for your reply, but that is indeed my default setting and it does not solve the issue. I want al the attribute names to be lowercase. Just by using the BulkAttributeRenamer. But when using that transformer in combination with the Dynamic Workflow unsuspected behavior occurs...

 

 

Badge +2

issue-dynamicworkflow-bulkattributerename.zip

- data.shp - sample data

- ..\\output\\data.shp - sample results with renamer in the dynamic workflow

- dynamicworkflow_bulkattributerenamer.fmw - workspace with dynamic workflow and renamer

Userlevel 4
Badge +25

I think you can work around it by using a FeatureReader to separate the schema feature, then set that to lowercase and use it as a source for the output schema.

Badge +2

I think you can work around it by using a FeatureReader to separate the schema feature, then set that to lowercase and use it as a source for the output schema.

Still doesn't work:

 

I have multiple shapefiles as input.

 

Then I have to connect all those shapefiles seperately to the Writer (as far as I know)

 

After running the Workspace, the output contains the geometry, but the attribute values are gone (NULL). But yes, the attribute names are now in lowercase.

 

 

Badge +2

And an addition from @Mark2AtSafe : posted here in the Dynamic Workflow Tutorial: https://knowledge.safe.com/articles/1050/dynamic-workflow-tutorial-introduction.html?childToView=79361#comment-79361

Badge +2

And an addition from @Mark2AtSafe : posted here in the Dynamic Workflow Tutorial: https://knowledge.safe.com/articles/1050/dynamic-workflow-tutorial-introduction.html?childToView=79361#comment-79361

"This is because the writer schema no longer matches the reader schema. A dynamic workspace lets you write any data by assuming the source data is the schema to be written. So if you change the attributes in the workspace then it is no longer a match and will fail.

 

If your source data is going to remain constant (i.e. the data being read always has the same attributes), then you'd be better to use the Automatic mode on the writer attributes (not Dynamic).

 

If your source data is going to change (i.e. the data being read may vary in its attributes) then changing those attributes mid-translation is more complicated. You'd need to have a schema defined somewhere that matched (either a dataset, or as a table) or you would need to construct the output schema during the translation."
Badge +2

I have the solution. I am simply using the Dynamic Worklow and setting the transformers BulkAttributeRenamer together with the SchemaSetter at work, using the right parameters... details and examples will follow asap. @sigtill @redgeographics @Mark2AtSafe

Badge +2
Sharing the solution....

 

- Dynamic workflow with two Workspaces

 

- Shapefiles to test with

 

 

Follow settings as mentioned in the Dynamic Workflow Tutorial mentioned somewhere in this Question...

 

 

Some specific things to be aware of:

 

> Workspace "bulk_renamer.fmw"

 

- I am not sure if it is necessary, but I did it: clean up the file list in the Reader

 

- Set 'Case-sensitive Filter' to be checked (properties reader on the Parameters tab)

 

- Clean up the list of attributes in the Writer. Only some exposed 'fme_' attributes cannot be deleted, but that's ok

 

 

> Workspace "bulk_renamer_workspacerunner.fmw"

 

- no specific things

 

 

 

Dynamic Workflow:

 

 

WorkspaceRunner that runs the Dynamic Workflow:

The ZIP file with Workspaces and shapefiles: bulkrenamer.zip

Userlevel 2
Badge +17
Hi @HarmenKampinga, I think @redgeographics's approach should work if you insert a BulkAttributeRenamer onto the data features' flow, like this.

 

dynamicworkflow-bulkattributerenamer.fmwt (FME 2017.1.2.1)

 

Note: In this configuration, the value of "fme_feature_type_name" in the schema feature will be used as the schema definition name, which should be equal to the value of "fme_feature_type" (source feature type name) in the data features. Therefore, it won't work if the source Shapefile filename contains upper case characters, because the value of "fme_feature_type_name" in the schema feature will also be changed to lower case (i.e. it will become different name from "fme_feature_type").

 

If a source Shapfile filename could contain upper case characters, you will have to add one of these operations.

 

  • On the schema features' flow, save the value of "fme_feature_type_name" as a global variable before the StringCaseChanger and restore it later.
  • Or, on the data features' flow, change the value of "fme_feature_type" to lower case, if it's allowed to change all the destination feature type names to lower case.
Hope this helps.
Userlevel 2
Badge +17

I think you can work around it by using a FeatureReader to separate the schema feature, then set that to lowercase and use it as a source for the output schema.

Hi @HarmenKampinga, I think @redgeographics's approach should work if you insert a BulkAttributeRenamer onto the data features' flow, like this.

 

dynamicworkflow-bulkattributerenamer.fmwt (FME 2017.1.2.1)

 

Note: In this configuration, the value of "fme_feature_type_name" in the schema feature will be used as the schema definition name, which should be equal to the value of "fme_feature_type" (source feature type name) in the data features. Therefore, it won't work if the source Shapefile filename contains upper case characters, because the value of "fme_feature_type_name" in the schema feature will also be changed to lower case (i.e. it will become different name from "fme_feature_type").

 

If a source Shapfile filename could contain upper case characters, you will have to add one of these operations.

 

  • On the schema features' flow, save the value of "fme_feature_type_name" as a global variable before the StringCaseChanger and restore it later.
  • Or, on the data features' flow, change the value of "fme_feature_type" to lower case, if it's allowed to change all the destination feature type names to lower case.
Hope this helps.
Userlevel 2
Badge +17
Hi @HarmenKampinga, I think @redgeographics's approach should work if you insert a BulkAttributeRenamer onto the data features' flow, like this.

 

dynamicworkflow-bulkattributerenamer.fmwt (FME 2017.1.2.1)

 

Note: In this configuration, the value of "fme_feature_type_name" in the schema feature will be used as the schema definition name, which should be equal to the value of "fme_feature_type" (source feature type name) in the data features. Therefore, it won't work if the source Shapefile filename contains upper case characters, because the value of "fme_feature_type_name" in the schema feature will also be changed to lower case (i.e. it will become different name from "fme_feature_type").

 

If a source Shapfile filename could contain upper case characters, you will have to add one of these operations.

 

  • On the schema features' flow, save the value of "fme_feature_type_name" as a global variable before the StringCaseChanger and restore it later.
  • Or, on the data features' flow, change the value of "fme_feature_type" to lower case, if it's allowed to change all the destination feature type names to lower case.
Hope this helps.
Another workaround to resolve the issue on the upper case in feature type name.

 

You can create a new attribute to store the lower case feature type name and set it to the Schema Definition Name. Probably this would be the best solution if a source Shapefile filename could contain upper case characters.

 

Badge +2
Hi @HarmenKampinga, I think @redgeographics's approach should work if you insert a BulkAttributeRenamer onto the data features' flow, like this.

 

dynamicworkflow-bulkattributerenamer.fmwt (FME 2017.1.2.1)

 

Note: In this configuration, the value of "fme_feature_type_name" in the schema feature will be used as the schema definition name, which should be equal to the value of "fme_feature_type" (source feature type name) in the data features. Therefore, it won't work if the source Shapefile filename contains upper case characters, because the value of "fme_feature_type_name" in the schema feature will also be changed to lower case (i.e. it will become different name from "fme_feature_type").

 

If a source Shapfile filename could contain upper case characters, you will have to add one of these operations.

 

  • On the schema features' flow, save the value of "fme_feature_type_name" as a global variable before the StringCaseChanger and restore it later.
  • Or, on the data features' flow, change the value of "fme_feature_type" to lower case, if it's allowed to change all the destination feature type names to lower case.
Hope this helps.
Interesting! Thank you @takashi

 

I will have a look at it
Badge +2
Another workaround to resolve the issue on the upper case in feature type name.

 

You can create a new attribute to store the lower case feature type name and set it to the Schema Definition Name. Probably this would be the best solution if a source Shapefile filename could contain upper case characters.

 

This works also very nice! Also thanks to @redgeographics for the initial answer!

 

 

Reply