Hey @cavarly, according to our documentation the Reader as a Resource will perform the reading of the up-to-date schema when required at runtime, which to me sounds like FME will read the schema when the workspace is run, and not right-before the Writer begins writing features.
There are a couple of ways to workaround this. You could use the FeatureReader to read in only the schema from your XML dataset and then send this schema to the Dynamic writer. In the Dynamic Writer, you would set the Schema Source to Schema From Schema Feature and the Schema Definition Name to the fme_feature_type_name attribute. An example of how to setup the dynamic writer can be seen here: https://community.safe.com/s/article/dynamic-workflow-tutorial-destination-schema-is-de-2
Another method would be to use a Parent/Child workspace to run the process you described. The parent workspace would do all the processing right up to before the dynamic writing. Then, the child workspace (invoked using a WorkspaceRunner), would read the new reader resource and perform the dynamic write operation.
Hey @cavarly, according to our documentation the Reader as a Resource will perform the reading of the up-to-date schema when required at runtime, which to me sounds like FME will read the schema when the workspace is run, and not right-before the Writer begins writing features.
There are a couple of ways to workaround this. You could use the FeatureReader to read in only the schema from your XML dataset and then send this schema to the Dynamic writer. In the Dynamic Writer, you would set the Schema Source to Schema From Schema Feature and the Schema Definition Name to the fme_feature_type_name attribute. An example of how to setup the dynamic writer can be seen here: https://community.safe.com/s/article/dynamic-workflow-tutorial-destination-schema-is-de-2
Another method would be to use a Parent/Child workspace to run the process you described. The parent workspace would do all the processing right up to before the dynamic writing. Then, the child workspace (invoked using a WorkspaceRunner), would read the new reader resource and perform the dynamic write operation.
Dan thanks for your help I will try your first workaround.
Hi Dan, I have tried the FeatureReader you mentioned. I forgot to say that there are domains and subtypes in the xml. Your method works but the domains and subtypes are missing.
I would prefer not to use a workspace runner. Can you think of any other way to read in the modified xml just before writing?
It is very frustrating, I am so close to my solution.
Is there any reason why there could not be a flag to delay reading the xml until all features have reached the writer, or something similar?
Thanks,
Ian
Hi Dan, I have tried the FeatureReader you mentioned. I forgot to say that there are domains and subtypes in the xml. Your method works but the domains and subtypes are missing.
I would prefer not to use a workspace runner. Can you think of any other way to read in the modified xml just before writing?
It is very frustrating, I am so close to my solution.
Is there any reason why there could not be a flag to delay reading the xml until all features have reached the writer, or something similar?
Thanks,
Ian
@cavarly if you're able to share your workspace this will help give us a better idea of what you're trying to achieve & what formats you're working with. If you're not able to share your workspace file (.fmw), are you able to provide some more details on what your source & destination formats are? I'm curious if your XML file just contains the schema or if you're using an XML Workspace Document in a File GDB writer.
With your workspace and some better context I'll test if there's another way to do what you're trying to do, however the two methods that I outlined already are the only ones that come to mind.
Hi Dan, the workspace is pretty big and only the portion to write out the results is not working.
1 I load an ADAC XML file and process to create features.
2 Once this processing is complete I initiate a read on the ESRI Workspace XML file.
3 I modify the XML to contain only the feature types present the ADAC XML.
4 I try to read in this updated ESRI workspace XML to use as the schema for dynamic writing to GDB.
I can’t figure out how to use the updated schema in the writer.
In 3 I have verified that the modified Workspace XML is good by importing it in ArcMap to create a GDB. However in the process of updating it I do get a mixture of < > and <. etc characters and a few spurious xml header added in (I manually clean it at the moment) - so some questions for you there too!
I have a version working which uses a GDB template , with all possible feature classes, and then use a python shutdown script to delete empty feature classes, but I thought the XML way would be better.
The script will need to work in Server.
Thanks for any solutions , in advance,
Ian
Hi Dan, the workspace is pretty big and only the portion to write out the results is not working.
1 I load an ADAC XML file and process to create features.
2 Once this processing is complete I initiate a read on the ESRI Workspace XML file.
3 I modify the XML to contain only the feature types present the ADAC XML.
4 I try to read in this updated ESRI workspace XML to use as the schema for dynamic writing to GDB.
I can’t figure out how to use the updated schema in the writer.
In 3 I have verified that the modified Workspace XML is good by importing it in ArcMap to create a GDB. However in the process of updating it I do get a mixture of < > and <. etc characters and a few spurious xml header added in (I manually clean it at the moment) - so some questions for you there too!
I have a version working which uses a GDB template , with all possible feature classes, and then use a python shutdown script to delete empty feature classes, but I thought the XML way would be better.
The script will need to work in Server.
Thanks for any solutions , in advance,
Ian
@cavarly some more thoughts here to try and get your workspace up & running...
You could try using the SchemaScanner transformer to scan the schema from your ESRI workspace XML and then apply this schema in your Dynamic GDB Writer.
The advantage with the SchemaScanner is that it allows you to re-scan the schema of your XML after you've made changes to it to contain only feature types present in the ADAC XML.
Check out the following article for more information on how the SchemaScanner functions: https://community.safe.com/s/article/How-to-SchemaScanner-Transformer
The SchemaScanner will create a schema for each fme_feature_type value, so you'll need to make sure that the fme_feature_type of your ESRI Workspace XML matches the fme_feature_type fo the data you want to insert into your GDB. The SchemaScanner also has a "Group By" which may or may not be useful if you want to group your schema by a certain attribute.
If you're not making any progress with your workspace, I suggest submitting a case through our portal here: https://community.safe.com/s/submit-case