In an FME reader under the User Attributes tab it shows a table of the reader's schema with the attribute names and datatypes as rows. What I want to do is to write a table like this to an excel file. In other words I want the attribute names and datatypes as rows not the attribute values themselves. Is there a way to do this?
Page 1 / 1
Hi Daniel, Try this link , you might need a python caller. then use the GetAttribute Method, Steve
http://www.techques.com/question/26-27256/FME-values-used-in-python
Hi Daniel, the Schema (Any Format) Reader might help you.
http://docs.safe.com/fme/html/FME_ReadersWriters/Default.htm#schema/schema.htm
Takashi
Thanks for the replies. The Schema (Any Format) Reader combined with a ListExploder to give the attribute list gave me exactly what I wanted - Thanks Takashi. I will have to look into using the Python caller sometime as well.
Regarding the Python FME Objects API.
FMEFeature.getAllAttributeNames method returns a list containing all the attribute names including format attributes.
And FMEFeature.getAttributeNullMissingAndType method can be used to know data type of a specific attribute, but it returns a data type identifier interpreted internally by FME, does not return a data type name defined in the source dataset. There is not a simple API method to retrieve data type names defined in a dataset.
A possible way is:
- create an FMEUniversalReader class instance associated to the format,
- call its "open" method to open the dataset,
- and then call its "readSchema" method to create features containing schema information as attributes for each feature type in the dataset.
It will be a good, interesting challenge to learn more about the API, it's worth to try. But I don't think it's a practical solution in this case.
In the actual workspace, I would recommend you to use the Schema (Any Format) Reader.