Hello All,
Is there a way in FME to transform the CSV table here below:
into this:
Thanks!
Hello All,
Is there a way in FME to transform the CSV table here below:
into this:
Thanks!
Yes:
Use the AttributeCreator (Name @Value(TYPE) and Value @Value(VALUE)) to create a new attribute with the name mentioned in the TYPE attribute.
Then use an Aggregator (group by ID, FROM, TO, PROFILE) to merge into one line.
Then create the output with all desired attributes.
Yes:
Use the AttributeCreator (Name @Value(TYPE) and Value @Value(VALUE)) to create a new attribute with the name mentioned in the TYPE attribute.
Then use an Aggregator (group by ID, FROM, TO, PROFILE) to merge into one line.
Then create the output with all desired attributes.
Yes:
Use the AttributeCreator (Name @Value(TYPE) and Value @Value(VALUE)) to create a new attribute with the name mentioned in the TYPE attribute.
Then use an Aggregator (group by ID, FROM, TO, PROFILE) to merge into one line.
Then create the output with all desired attributes.
You can use the AttributeExposer to expose the new attributes if necessary.
Interesting question. When I looked at this I was reminded of the AttributePivoter, which made a debut in FME a couple years back. It does exactly what is desired -- it can collapse a set of rows into a single one, and add new columns (attributes) whose name comes from one older column and whose value is a statistical calculation of another.
I've attached a template that does this. Note -- this only works if the "value"s are numeric. I believe this is so in the input, despite seeing a comma as the decimal separator. If not, it is easy to string substitute a , with a . , do the pivot, and then substitute back again.
It is a bit tricky to set this up and you do need to set your writer to be in "dynamic" mode, but check all the settings in the attached and they should get you pointed the right way.
Interesting question. When I looked at this I was reminded of the AttributePivoter, which made a debut in FME a couple years back. It does exactly what is desired -- it can collapse a set of rows into a single one, and add new columns (attributes) whose name comes from one older column and whose value is a statistical calculation of another.
I've attached a template that does this. Note -- this only works if the "value"s are numeric. I believe this is so in the input, despite seeing a comma as the decimal separator. If not, it is easy to string substitute a , with a . , do the pivot, and then substitute back again.
It is a bit tricky to set this up and you do need to set your writer to be in "dynamic" mode, but check all the settings in the attached and they should get you pointed the right way.
I noticed a writer is necessary to get the new attributes created by AttributePivot. Since I still need the results for further process, but no normal transformer can be used directly after AttributePivtor because they cannot get those new attributes, right?
You can use the AttributeExposer to expose the new attributes if necessary.
I noticed a writer is necessary to get the new attributes created by AttributePivot. Since I still need the results for further process, but no normal transformer can be used directly after AttributePivtor because they cannot get those new attributes, right?
Manually mutate New attribute to @Value(@Value(TYPE))
This will create the attribute name by its content.