Skip to main content

I'm trying to setup a workspace that allows the user to choose what attributes to keep in the final spreadsheet. But AttributeKeeper seems to work wrong when passing User Parameters in the "Attributes to Keep" box.

 

I've created a User Parameter of the type "Attribute Name" that allows to select multiple attributes, and I've setup AttributeKeeper to use this parameter.

 

I'm facing the following:

1- When selecting only one attribute: Schema gets lost, but the attribute is still retrievable by exposing it.

2- When selecting more than one attribute: Both schema and attributes get lost.

3- Noticed that AttributeKeeper has a comma delimiter when multiple attributes are selected, while "Attribute Name" User Parameters use a blank space as a delimiter. So I've created a third parameter of the type "Text" with the value "a1,a2" (where a1 and a2 are the attributes), to see if this makes any difference. This again results in no schema or attributes as well.

 

Am I doing something wrong or is this a bug? Can someone explain this behaviour?

 

I've attached the workspace in this post.

I'm using FME Form 2022.2

 

 

 


https://community.safe.com/s/question/0D5Dm00000c7p00KAA/using-choice-user-parameter-in-attributekeeper

The AttributeKeeper isn't really designed to work in the way your trying to use it, hence the weird behaviour. The attributekeeper relies on the known schema (and selected attributes) that are present when you build your workbench.

 

A better and more reliable way (albeit a bit more advanced, but much more powerful) is to use a dynamic writer along with a schema feature. Basically you'd still have the user specify the attributes they want in the output and use them to build a schema feature. This is then passed to the dynamic writer (excel) and used to create the output schema.

 

You can read more on this style of workflow here:

http://docs.safe.com/fme/2017.1/html/FME_Desktop_Documentation/FME_Workbench/Workbench/Deriving-Destination-Schema-from-Schema-Feature.htm

https://community.safe.com/s/article/dynamic-workflow-tutorial-destination-schema-is-de-2


If you create the parameter from the AttributeKeeper itself then it works for me (but the attributes are still not exposed).

 

image 

As @hkingsbury​ mentioned you'll need to do some dynamic stuff but the new SchemaScanner makes it pretty easy to now (FME 2022) - Here you can see how you could set it up with just a handful of transformers.

 

image


The AttributeKeeper isn't really designed to work in the way your trying to use it, hence the weird behaviour. The attributekeeper relies on the known schema (and selected attributes) that are present when you build your workbench.

 

A better and more reliable way (albeit a bit more advanced, but much more powerful) is to use a dynamic writer along with a schema feature. Basically you'd still have the user specify the attributes they want in the output and use them to build a schema feature. This is then passed to the dynamic writer (excel) and used to create the output schema.

 

You can read more on this style of workflow here:

http://docs.safe.com/fme/2017.1/html/FME_Desktop_Documentation/FME_Workbench/Workbench/Deriving-Destination-Schema-from-Schema-Feature.htm

https://community.safe.com/s/article/dynamic-workflow-tutorial-destination-schema-is-de-2

Thanks for your help. I was able to configure the tool as desired following your advice manipulating schema features.

 

I still think AttributeKeeper there's something wrong with the AttributeKeeper when using UserParameters. Otherwise, why does the transformer allow to add UserParameters, if the result isn't right. I may be missing something, but anyway, I don't need it anymore.


If you create the parameter from the AttributeKeeper itself then it works for me (but the attributes are still not exposed).

 

image 

As @hkingsbury​ mentioned you'll need to do some dynamic stuff but the new SchemaScanner makes it pretty easy to now (FME 2022) - Here you can see how you could set it up with just a handful of transformers.

 

image

Thanks for your reply. I also tried to create the User Parameter from the transformer, but it didn't work for me (I think when selecting more than one attribute). Anyway I don't need AttributeKeeper anymore given @hkingsbury​ 's solution.


Reply