Solved

How do handle attribute creation from Run user settings


Badge

I am using a few check boxes at the Run window to let the user choose a few different things. I'd like different action to result from whether a tick box is checked or not.

I can do that ok using a Tester and checking if the user Parameter is YES or NO, and the test works well, but this gets ignored by a FeatureMerger a bit later.

The workbench somewhat carries on no matter what the test result is.

 

The end goal is to only create attributes if the user tick a box or not. Are there examples of that?

 

tile_product_maker 

No features should go to the bookmark in yellow, but it does anyway despite failing the test. And the FeatureMerger returns empty values of course.

I'd like to get rid of the Attribute with empty values before they get exported.

What's the best way to do that? Let it merge then remove the attribute? if user-parameter is NO -> AttributeRemover on X

 

I'd be a lot easier with Python, am i missing something obvious?

I tried this but can't make it work: https://community.safe.com/s/question/0D54Q000080hBtRSAU/remove-all-attributes-with-empty-fields

icon

Best answer by caracadrian 30 July 2021, 11:14

View original

2 replies

Badge +20

FeatureMerger behaves this way. Onece it creates a list of attributes it doesn't stop one from getting through to Inspector. But this behavior applies only to the list of exposed attributes, not the attributes that the feature has.

If an attribute is <missing> then that features doesn't actually have that attribute.

Have a look at this screenshot of inspector:

missing in inspectorIn the column view att2 is present and of value <missing> but in the Feature Information pane it is not present.

You can create different Schemas with SchemaMapper on each branch of your workspace and configure your Writer as Dynamic with Schema Sources set to Schema from Schema Feature. The writer checks the first feature for the presence of a specific type of list attribute that provides schema information. If this list is found on the first feature, it can be used to generate the output schema for the writer.

Badge

FeatureMerger behaves this way. Onece it creates a list of attributes it doesn't stop one from getting through to Inspector. But this behavior applies only to the list of exposed attributes, not the attributes that the feature has.

If an attribute is <missing> then that features doesn't actually have that attribute.

Have a look at this screenshot of inspector:

missing in inspectorIn the column view att2 is present and of value <missing> but in the Feature Information pane it is not present.

You can create different Schemas with SchemaMapper on each branch of your workspace and configure your Writer as Dynamic with Schema Sources set to Schema from Schema Feature. The writer checks the first feature for the presence of a specific type of list attribute that provides schema information. If this list is found on the first feature, it can be used to generate the output schema for the writer.

Thank you, I'll try using the SchemaMapper. It's a lot of extra work though, the SchemaMapper always need an external file right?

Reply