If they are always the same attributes names each time then you can just use the attributeexposer, as you mentioned. It won't show them in the drop-down but that doesn't matter. You just need to expose them regardless
Are the date attributes in the original spreadsheet?
If so, then using a dynamic writer and Schema Sources set to the spreadsheet reader should work.
If not, then check out
https://knowledge.safe.com/articles/1051/dynamic-w...You will need to explicitly add your dynamic attributes to the schema list. Python is probably the easiest way to do this.
Are the date attributes in the original spreadsheet?
If so, then using a dynamic writer and Schema Sources set to the spreadsheet reader should work.
If not, then check out
https://knowledge.safe.com/articles/1051/dynamic-w...You will need to explicitly add your dynamic attributes to the schema list. Python is probably the easiest way to do this.
The dates are in the original spreadsheet, but they are values in a column, not attributes. I don't think it is possible to turn values into schema this way.
If they are always the same attributes names each time then you can just use the attributeexposer, as you mentioned. It won't show them in the drop-down but that doesn't matter. You just need to expose them regardless
There were 286 dates, so I didn't want to manually enter them. Rather, I used a PythonCaller to create a csv file and populate it with each date that came through the tranformer. The result is:
2016-01-08,2016-01-15,2016-01-22,2016-01-29,2016-02-05,
Then in the AttributeExposer I ran the Import Attribute Names wizard and imported the csv file. I just have to do that again every time that the spreadsheet changes, but it is only once a year.
See attached workspace for a proof of concept of dynamically creating the attribute schema. All non fme attributes (hidden or exposed) are written out.
dynamicattributes.fmw
See attached workspace for a proof of concept of dynamically creating the attribute schema. All non fme attributes (hidden or exposed) are written out.
dynamicattributes.fmwThanks for that explanation, jdh. The Dynamic Workflows tutorial that you linked to above did not make sense to me, but it does now.
For those people who don't want to call Python you can use a Schema Reader to get the list of attribute names, turn that into a newline separated list and then submit that to a sub workspace with WorkspaceRunner as a static parameter. Then in a FeatureReader set the attributes to expose as the user parameter. Solved! After years of answers that 'it is not possible'.
It does require two workspaces linked by the WorkspaceRunner but I submit that this is a Safe Solution. There is a rumour that FME 2020 would do something like this but I cannot see it in the Beta.
Debug the second workspace by pasting the list printed to the log (without the quotes). The second workspace needs another schema reader and a FeatureReader which has a tab to list the attributes to expose which can be the input parameter list.
I added the fme_feature_type and deleted OBJECTID in the first workspace. Note that you have to read the schema again in the second workspace. This basic idea was posted by Robin that gave me the idea to extend it to a dynamic list. This list must be set at the beginning, a Variable is not acceptable.
For those people who don't want to call Python you can use a Schema Reader to get the list of attribute names, turn that into a newline separated list and then submit that to a sub workspace with WorkspaceRunner as a static parameter. Then in a FeatureReader set the attributes to expose as the user parameter. Solved! After years of answers that 'it is not possible'.
It does require two workspaces linked by the WorkspaceRunner but I submit that this is a Safe Solution. There is a rumour that FME 2020 would do something like this but I cannot see it in the Beta.
Debug the second workspace by pasting the list printed to the log (without the quotes). The second workspace needs another schema reader and a FeatureReader which has a tab to list the attributes to expose which can be the input parameter list.
I added the fme_feature_type and deleted OBJECTID in the first workspace. Note that you have to read the schema again in the second workspace. This basic idea was posted by Robin that gave me the idea to extend it to a dynamic list. This list must be set at the beginning, a Variable is not acceptable.
Hu @kimo - where exactly are you pasting from the log? Thanks for this idea but I am stuck at the list attribute - I've set up the list how you had it but when i pass that through the Workspace Runner to the Feature Reader all i get is a multi line attribute 'exposed' instead of the individual attributes. Also, what do you mean the list must be set at the beginning and not a variable - maybe this is where I'm lost - thanks!