Im working with this original template(https://knowledge.safe.com/articles/59335/autocad-dwg-block-attribute-extraction.html). Same reader, but now the Writer is a Geotable. I have added additional transformers for coordinates and to extract attributes in multiple fields instead of one field with all attributes as a list. This is where my question takes place, If I am for example exposing 10 elements(from the AttributeSplitter) but only 6 elements have attribute data, How can I set it up to automatically remove/delete the 4 elements from the Writer that have null values? Attached is the file I am working with, which has the example I mentioned above.
Hello @gerardor. Thanks for your question. It sounds to me your question is about how to remove attributes that only contain null values from the schema, so they won't be written on the output. If my interpretation of your question is correct, I encourage you to check out this other Forum thread, where some community members, including myself, had provided some suggestions. https://knowledge.safe.com/questions/38286/remove-empty-fields.html
My answer included a template you could try and adapt to your own workflow.
Hope that helps!
Cheers,
Hello @gerardor. Thanks for your question. It sounds to me your question is about how to remove attributes that only contain null values from the schema, so they won't be written on the output. If my interpretation of your question is correct, I encourage you to check out this other Forum thread, where some community members, including myself, had provided some suggestions. https://knowledge.safe.com/questions/38286/remove-empty-fields.html
My answer included a template you could try and adapt to your own workflow.
Hope that helps!
Cheers,
I believe this workflow from the Forum thread you directed me is more for a table or feature that is set in place or existing. The workflow that I am working with is extracting blocks with attributes(tags and values), and writing it out as a geotable. I am looking for a way to remove attributes within my workflow process. Does this make sense?
I believe this workflow from the Forum thread you directed me is more for a table or feature that is set in place or existing. The workflow that I am working with is extracting blocks with attributes(tags and values), and writing it out as a geotable. I am looking for a way to remove attributes within my workflow process. Does this make sense?
Ah, I see your point @gerardor. Would love to hear what others think.
Currently, my only idea would be to write out a temporary file (could even consider FME's own internal format .ffs). You can still achieve this in one workspace:
- Build on our current workflow. After you've extracted and exposed all the attribute, use a FeatureWriter to write out the intermediate output, that has all the attributes written, regardless of whether they have values or not.
- Use the same method in the thread that I linked above, the FeatureReader can read back the intermediate output and produce the schema feature.
Would this work?
Ah, I see your point @gerardor. Would love to hear what others think.
Currently, my only idea would be to write out a temporary file (could even consider FME's own internal format .ffs). You can still achieve this in one workspace:
- Build on our current workflow. After you've extracted and exposed all the attribute, use a FeatureWriter to write out the intermediate output, that has all the attributes written, regardless of whether they have values or not.
- Use the same method in the thread that I linked above, the FeatureReader can read back the intermediate output and produce the schema feature.
Would this work?
@xiaomengatsafe not quite sure what was the actual procedure you described. Is writing out to the temporary file part of the workflow you mentioned in both bullet points?
@xiaomengatsafe not quite sure what was the actual procedure you described. Is writing out to the temporary file part of the workflow you mentioned in both bullet points?
@gerardor, sorry for the confusion. I'll try to clarify the steps:
- As you mentioned that you've already managed to extract attributes in multiple fields. Let's build on this workflow.
- Add a FeatureWriter transformer (which can write output in the middle of a workflow), to write out the result of step 1, as intermediate output.
- Add a FeatureReader after the FeatureWriter in step 2, to read the intermediate output back into the workspace.
- Now, the FeatureReader is the starting point of the workflow introduced in the other thread, which should help remove attributes that contain no value, so they won't be written to the final output.
Hope this is a bit more clear. :)
@gerardor, sorry for the confusion. I'll try to clarify the steps:
- As you mentioned that you've already managed to extract attributes in multiple fields. Let's build on this workflow.
- Add a FeatureWriter transformer (which can write output in the middle of a workflow), to write out the result of step 1, as intermediate output.
- Add a FeatureReader after the FeatureWriter in step 2, to read the intermediate output back into the workspace.
- Now, the FeatureReader is the starting point of the workflow introduced in the other thread, which should help remove attributes that contain no value, so they won't be written to the final output.
Hope this is a bit more clear. :)
@xiaomengatsafe The output that I am getting is the same one if I would put together the first part of my workflow and just write to a dynamic writer. What can be the problem? I have attached my workbench file. It is automatically removing the AutoCAD attributes out(autocad_block_name, autocad_elevation,autocad_layer, etc.)
Also, will this work for when the FeatureWriter contains multiple features instead of a single feature?
Please advise
Thank you
AutoCADBlockExtraction_remove fields.fmw
@xiaomengatsafe The output that I am getting is the same one if I would put together the first part of my workflow and just write to a dynamic writer. What can be the problem? I have attached my workbench file. It is automatically removing the AutoCAD attributes out(autocad_block_name, autocad_elevation,autocad_layer, etc.)
Also, will this work for when the FeatureWriter contains multiple features instead of a single feature?
Please advise
Thank you
AutoCADBlockExtraction_remove fields.fmw
Hi @gerardo, I had a look at the workspace you created, and spotted a few things that might be causing you trouble. I edited the workspace and added notes on why I suggested those changes.
Note: The changes suggested for the FeatureWriter should be made on your end.
27639-autocadblockextraction-remove-fields_new.fmw
Hi @gerardo, I had a look at the workspace you created, and spotted a few things that might be causing you trouble. I edited the workspace and added notes on why I suggested those changes.
Note: The changes suggested for the FeatureWriter should be made on your end.
27639-autocadblockextraction-remove-fields_new.fmw
Hello @xiaomengatsafe, After applying the changes provide it doesnt seem to do anything after the FeatureReader. I have tried to under the FeatureReader within the "Feature Types to Read:" the 4 options it gives me to read but nothing is being output beyond the FeatureReader.
Hello @xiaomengatsafe, After applying the changes provide it doesnt seem to do anything after the FeatureReader. I have tried to under the FeatureReader within the "Feature Types to Read:" the 4 options it gives me to read but nothing is being output beyond the FeatureReader.
Hello @gerardor, Sorry to hear you are still having issues. I think maybe the best way to get to the bottom of this, is through a support case with our technical experts. Please file a case under this link, and include your current workspace as well as a sample data. It would also help if you reference our discussion in this Q&A thread.
Thank you!
Hello @gerardor, Sorry to hear you are still having issues. I think maybe the best way to get to the bottom of this, is through a support case with our technical experts. Please file a case under this link, and include your current workspace as well as a sample data. It would also help if you reference our discussion in this Q&A thread.
Thank you!
Hi @xiaomengatsafe, I will move forward in doing that. Thank you for your help.