To expand the application range, I would suggest a new transformer which allows users to modify schema contents - attribute names and data types stored in the "attribute{}" list easily.
The transformer receives schema features, modifies the contents, and then outputs resulting schema features. Required functionalities should be:
- rename attributes (string replace, regex replace)
- add a common prefix/suffix to attributes matching specified condition (or all)
- remove specified prefix/suffix from attributes matching specified condition (or all)
- change case of attributes matching specified condition (or all)
- remove attributes matching specified condition (exact match, starting with, ending with, regex match)
- replace data type of attributes matching specified condition (name and/or original data type)
- add attributes (pairs of name and data type)
more?
The important thing is that the transformer should be a feature-based one. Since every schema feature read by the FeatureReader will have to arrive in the dynamic writer feature type (Schema Sources: "Schema from first feature") before any data feature belonging to the same feature type. If it wasn't so, the worth would be a half.
If the "all in one" would be too complicated, divide the functionalities into 2 - 3 parts, and multiple transformers may be defined for each part.
"How about a transformer, e.g. the SchemaCreator, that lets you define the
contents of the attribute{} list via
the GUI? You could reuse parts of the dialog used for feature type user
attributes, e.g.
For the
example above, the transformer would output the following attributes
(overwriting any existing attribute{}-list):
attribute{0}.name
= 'objectid'
attribute{0}.fme_data_type
= 'fme_uint32'
attribute{1}.name
= 'mystring'
attribute{1}.fme_data_type
= 'fme_char(255)'
attribute{2}.name
= 'somevalue'
attribute{2}.fme_data_type
= 'fme_decimal(10,3)'
attribute{3}.name
= 'when'
attribute{3}.fme_data_type
= 'fme_datetime'
You
could even add a column with the incoming attributes to rename to the newly
created schema attributes (think built-in AttributeRenamer)."
Good suggestion. I also wish a transformer that can be used to create schema definition easily. I often use scripts to create or modify the attribute{} list. Guess you do so too. If there were transformers to do those easily, would bring all users great benefit.
Hi Mark
The SchemaSetter will take an incoming feature and create a corresponding list attribute. What is being proposed, is how to enable users to define (create and/or modify) this list manually without needing any incoming features, and preferrably with a user friendly interface.
David
Hi @mark_1spatial, my primary intention is to allow users to edit easily existing attribute{} list contained by schema features which have been read by the FeatureReader (<Schema> port, 2015.1+) or Schema (Any Format) reader. A potential use case I most recently found is:
Read dynamic (from sde) and write to dynamic (mapinfo)
Regarding the SchemaSetter, I believe it would be still useful but there are cases where it cannot satisfy user's requirement because it has some limitations, e.g.
- doesn't support some data types such as decimal, date, datetime,
- users cannot control width of character string type,
- will not generate schema definition of missing attributes in the input feature,
and so on.
These limitations cannot be avoided, since the transformer generates schema definition from the input data feature (not schema feature) and a data feature doesn't have enough information for configuring complete schema. The expected transformer might also complement such limitations.
At last, a way to make GML useful :-)
This would help a lot in converting to usefull formats.
I agree, very useful tool indeed
Two major releases later and it's currently sitting at 46 votes, plus this associated idea with 18 votes:
https://knowledge.safe.com/idea/48070/attributeremover-etc-to-work-with-schema-features.html
It would be fantastic to see something come out from all this enthusiasm :-)
Bump, yes please. Schema setter is good as a custom transformer, but I'm sure more could be done in this space.
Yes, please. I finally managed to climb the FME learning mountain, step by step.
And now I'm a bit stuck, changing feature types and managing schema for dynamic output is really hard.
Agree, I had to learn python to get round this!
Bump. Maybe add the ability to order attributes based on supplied sort order?
@daleatsafe how about now with 64 votes? :D
SchemaManager?
This would be so useful for me right now :)