Hi @marronm, what format are you reading with your FeatureReader? Additionally, what version of FME are you using?
If you're reading in values and exposing them via a csv file due to schema changes, you can look into using a dynamic workflow where the destination schema is a mirror image of the source dataset since this will preserve the order of the attributes: https://community.safe.com/s/article/dynamic-workflow-tutorial-destination-schema-as-a
The issue with the AttributeExposer not retaining the order of the attributes is a known bug with the transformer. We currently have a ticket open regarding this issue (FMEFORM-25548). I've added this question to the ticket so you get notified when the issue is resolved.
Thanks for your reply @danminneyatsaf , the formats I was reading in feature reader : geojson, file geodatabase, shapefile and CSV. My FME version is 2021.2. I tried using the dynamic workflow with the Generic (Any Format) reader however once one format is in, I couldn't change between formats. For example, I put in my geojson dataset in order to get the generic reader to appear on the workbench but when I tried to run the workbench it wouldn't let me change to an fgdb or shapefile format.
Thanks for your reply @danminneyatsaf , the formats I was reading in feature reader : geojson, file geodatabase, shapefile and CSV. My FME version is 2021.2. I tried using the dynamic workflow with the Generic (Any Format) reader however once one format is in, I couldn't change between formats. For example, I put in my geojson dataset in order to get the generic reader to appear on the workbench but when I tried to run the workbench it wouldn't let me change to an fgdb or shapefile format.
@marronm The workspace you setup there in your screenshot looks sufficient, does that work for you? My personal preference would be to use multiple FeatureReaders as you have it setup there and allow the user to specify what format they are providing.
You'll need to also connect the Schema output ports from your FeatureReaders to the Dynamic Writer to ensure the features are written out with the appropriate schema. In the Dynamic Writer parameters, you'll need to setup the parameters as in the screenshot below:
@danminneyatsaf Massive progress, thank you very much. The multiple feature readers work with the dynamic writer when I remove the “fme_feature_type_name”. If I leave it in, I get this error:
Cannot define schema for '' as the feature does not contain schema information, and schema source is set to 'Schema from Schema Feature'. Please verify writer feature type configuration
so I have left 'Schema Definition Name' blank.
I may be stretching here and this is not a deal breaker for the process but I am wondering is it possible to change the output table name through this FME process? At the moment, it takes the name from the “fme_feature_type”(which is the input file name)
@danminneyatsaf Massive progress, thank you very much. The multiple feature readers work with the dynamic writer when I remove the “fme_feature_type_name”. If I leave it in, I get this error:
Cannot define schema for '' as the feature does not contain schema information, and schema source is set to 'Schema from Schema Feature'. Please verify writer feature type configuration
so I have left 'Schema Definition Name' blank.
I may be stretching here and this is not a deal breaker for the process but I am wondering is it possible to change the output table name through this FME process? At the moment, it takes the name from the “fme_feature_type”(which is the input file name)
@marronm Great to hear that's mostly working for you now.
You can set the output table name to anything you want. You can change the value of fme_feature_type by using an AttributeExposer (to expose fme_feature_type) and then use an AttributeManager to change the value of fme_feature_type. Let me know if that works for you.
@danminneyatsaf not quite yet - I'm getting that error : Cannot define schema for 'IR_MM' as the feature does not contain schema information, and schema source is set to 'Schema from Schema Feature'. Please verify writer feature type configuration.
As I said this isn't a big issue but I'll go through exactly what I did incase I'm missing something. 'IR_MM' is my user parameter for the output table name. For the Attribute Exposer transformer, I typed in "fme_feature_type" as it wasn't coming up as an option in the drop down. Then for the Attribute Manager, I set the value of fme_feature_type to my user parameter "$(OUTPUT_table_name)" . I didn't make any changes to the dynamic writer this time around, table name remains as "fme_feature_type".
@danminneyatsaf not quite yet - I'm getting that error : Cannot define schema for 'IR_MM' as the feature does not contain schema information, and schema source is set to 'Schema from Schema Feature'. Please verify writer feature type configuration.
As I said this isn't a big issue but I'll go through exactly what I did incase I'm missing something. 'IR_MM' is my user parameter for the output table name. For the Attribute Exposer transformer, I typed in "fme_feature_type" as it wasn't coming up as an option in the drop down. Then for the Attribute Manager, I set the value of fme_feature_type to my user parameter "$(OUTPUT_table_name)" . I didn't make any changes to the dynamic writer this time around, table name remains as "fme_feature_type".
Where did you place the AttributeManager in your workspace (a screenshot if possible would help)? The fme_feature_type attribute will be used to match the schema to the corresponding features, so the schema and the features themselves will need to have their fme_feature_type value changed so that they match before reaching the Dynamic Writer.
@danminneyatsaf I put that AttributeManager in between AttributeExposer and Writer
@danminneyatsaf I put that AttributeManager in between AttributeExposer and Writer
Hi @marronm, apologies for the delayed reply as I was off during the Christmas holidays.
The Schema features use the fme_feature_type_name attribute to match up with the corresponding features, which is why you're receiving a warning saying that the schema information is missing.
Create a separate set of AttributeExposer + AttributeManager transformers for the Schema data coming from each of the FeatureReaders and then connect these to the Dynamic Writer. See the image below for an example.
In the AttributeManager, set the value for the fme_feature_type_name & the fme_feature_type attributes to $(OUTPUT_table_name).
Try giving your workspace another run and let me know if that works for you.
Hi @marronm, apologies for the delayed reply as I was off during the Christmas holidays.
The Schema features use the fme_feature_type_name attribute to match up with the corresponding features, which is why you're receiving a warning saying that the schema information is missing.
Create a separate set of AttributeExposer + AttributeManager transformers for the Schema data coming from each of the FeatureReaders and then connect these to the Dynamic Writer. See the image below for an example.
In the AttributeManager, set the value for the fme_feature_type_name & the fme_feature_type attributes to $(OUTPUT_table_name).
Try giving your workspace another run and let me know if that works for you.
@danminneyatsaf Worked a dream - thank you for all your help