Hi @jerome,
Have a look at the AttributeExploder transformer.
Hope this helps,
Itay
Hi @jerome,
Have a look at the AttributeExploder transformer.
Hope this helps,
Itay
Yes you're right. This transformer creates new records.
But I may have misspoke myself. I'm trying to automate the creation of attribute without writting the value in AttributeCreator.
@jerome
Maybe this can inspire ?:
https://knowledge.safe.com/storage/attachments/31115-31082-dynamci-key-kwak.fmw
You would have to replace the exposer and have schema creation, extraxtion or dynamic schemamaapping .
Hi @jerome,
When reading from table A, each row will be a separate feature. You can rename the value for each row to a distinct attribute name, then use an Aggregator to joins the rows into a single feature:
- If there is no row number on the features, create one with a Counter
- Use an AttributeCreator to create a unique column name attributeI ie. col_name) from the _count value (ie. col_@Value(_count)).
- Use a second AttributeCreator to create an attribute with name set to @Value(col_name) and value set to row value
- Use an Aggregator to aggregate all the rows into a single feature. Set Accumulation mode to Merge Incoming Attributes to get all the new column attributes added.
- You may need to add an AttributeExposer to expose these new attributes
I am attaching a simple workspace to illustrate the process.
mergerows.fmw
Hi @jerome,
When reading from table A, each row will be a separate feature. You can rename the value for each row to a distinct attribute name, then use an Aggregator to joins the rows into a single feature:
- If there is no row number on the features, create one with a Counter
- Use an AttributeCreator to create a unique column name attributeI ie. col_name) from the _count value (ie. col_@Value(_count)).
- Use a second AttributeCreator to create an attribute with name set to @Value(col_name) and value set to row value
- Use an Aggregator to aggregate all the rows into a single feature. Set Accumulation mode to Merge Incoming Attributes to get all the new column attributes added.
- You may need to add an AttributeExposer to expose these new attributes
I am attaching a simple workspace to illustrate the process.
mergerows.fmwThis is exactly what I was looking for. But I don't understand very well how it works with the first AttributeCreator.
How is it possible to create an attribute list with a single attribute definition?
@jerome
Maybe this can inspire ?:
https://knowledge.safe.com/storage/attachments/31115-31082-dynamci-key-kwak.fmw
You would have to replace the exposer and have schema creation, extraxtion or dynamic schemamaapping .
Thanks . It seems to be a complete solution. I m going to test it now.
Well I have made good progress ... but
Can we automate attribute import in attributeExposer?
Or how to fill a lot of attribute without any re-entry ?
Well I have made good progress ... but
Can we automate attribute import in attributeExposer?
Or how to fill a lot of attribute without any re-entry ?
That is a tricky one, since the attribute names are not known until runtime. If the names will be constant over different datasets, I use the following technique to mostly automate populating the AttributeExposer:
- Connect an AttributeExploder to the Aggregator output.
- Add a CSV writer to the workspace, then connect the output feature type to the AttributeExploder output. Only output the attribute 'attr_name'.
- Run the workspace to create the CSV file.
- Remove the AttributeExploder and CSV writer.
- Connect an AttributeExposer to the Aggregator output. Open the parameters, then click the Import button.
- Import form the CSV file you just created, using the CSV reader, and choosing to import Attribute Values instead of the default Attribute Names.
If the attributes will not be constant, you can try using the a combination of the FME Hub SchemaSetter transformer and using Dynamic mode on the writer.
Well I have made good progress ... but
Can we automate attribute import in attributeExposer?
Or how to fill a lot of attribute without any re-entry ?
Great !
That's a complete process you describe here.
I will note it immediately
But how do you know what object is known or not at runtime process ?
Do you know if exists runtime step option ?