Hi @heatha_featha, I suppose that you need to create these attributes from the two comma-separated values.
- `Timestamp' has value `"2016-03-17T12:00:00.000+01:00"'
- `Value' has value `0'
- `Quality Code' has value `130'
- `Absolute Value' has value `null'
- `AV Quality Code' has value `null'
If I understand your requirement correctly, this workflow might help you. The MultiAttributeSplitter is a custom transformer published in the FME Hub (ex FME Store).
Alternatively a PythonCaller with this script creates those attributes more efficiently.
def extractAttributes(feature):
names = feature.getAttribute('column').split(',')
values = feature.getAttribute('data').split(',')
for name, value in zip(names, values):
feature.setAttribute(name, value)
A TclCaller with this script does the same too.
proc extractAttributes {} {
set names esplit hFME_GetAttribute "column"] {,}]
set values psplit xFME_GetAttribute "data"] {,}]
foreach name $names value $values {
FME_SetAttribute $name $value
}
}
Hi @heatha_featha, I suppose that you need to create these attributes from the two comma-separated values.
- `Timestamp' has value `"2016-03-17T12:00:00.000+01:00"'
- `Value' has value `0'
- `Quality Code' has value `130'
- `Absolute Value' has value `null'
- `AV Quality Code' has value `null'
If I understand your requirement correctly, this workflow might help you. The MultiAttributeSplitter is a custom transformer published in the FME Hub (ex FME Store).
Alternatively a PythonCaller with this script creates those attributes more efficiently.
def extractAttributes(feature):
names = feature.getAttribute('column').split(',')
values = feature.getAttribute('data').split(',')
for name, value in zip(names, values):
feature.setAttribute(name, value)
A TclCaller with this script does the same too.
proc extractAttributes {} {
set names esplit hFME_GetAttribute "column"] {,}]
set values psplit xFME_GetAttribute "data"] {,}]
foreach name $names value $values {
FME_SetAttribute $name $value
}
}
Hi @takashi,' thank you for your quick response.
The MultiAttributeSplitter (useful tool) and the ListExploder work well. However when I inspect the output of the BulkAttributeRenamer a feature count is listed, however no data is shown, and the data column has simply been renamed to @value(column).
I would have expected that the intention of the regular expression in the BulkAttributeRenamer is to create 5 new columns, each containing the associated data values?
Can you please explain what is happening through the BulkAttributeRenamer and Agrregator in a bit more detail?
Hi @takashi,' thank you for your quick response.
The MultiAttributeSplitter (useful tool) and the ListExploder work well. However when I inspect the output of the BulkAttributeRenamer a feature count is listed, however no data is shown, and the data column has simply been renamed to @value(column).
I would have expected that the intention of the regular expression in the BulkAttributeRenamer is to create 5 new columns, each containing the associated data values?
Can you please explain what is happening through the BulkAttributeRenamer and Agrregator in a bit more detail?
Hi @heatha_featha, I think you entered '@Value(column)' as a string literal into the field. In this case, this parameter should be set to the value of 'column' attribute. Try setting it using the menu command, like this.
Hi @heatha_featha, I suppose that you need to create these attributes from the two comma-separated values.
- `Timestamp' has value `"2016-03-17T12:00:00.000+01:00"'
- `Value' has value `0'
- `Quality Code' has value `130'
- `Absolute Value' has value `null'
- `AV Quality Code' has value `null'
If I understand your requirement correctly, this workflow might help you. The MultiAttributeSplitter is a custom transformer published in the FME Hub (ex FME Store).
Alternatively a PythonCaller with this script creates those attributes more efficiently.
def extractAttributes(feature):
names = feature.getAttribute('column').split(',')
values = feature.getAttribute('data').split(',')
for name, value in zip(names, values):
feature.setAttribute(name, value)
A TclCaller with this script does the same too.
proc extractAttributes {} {
set names esplit hFME_GetAttribute "column"] {,}]
set values psplit xFME_GetAttribute "data"] {,}]
foreach name $names value $values {
FME_SetAttribute $name $value
}
}
Hi @takashi,', I am using FME 2015 and it doesn't have the additional Mode parameter. Can you please confirm that you are using the standard BulkAttributeRenamer transformer (from 2016?)?
Hi @takashi,', I am using FME 2015 and it doesn't have the additional Mode parameter. Can you please confirm that you are using the standard BulkAttributeRenamer transformer (from 2016?)?
Yes, the screenshot is from FME 2016.0, but you don't need to mind the Mode setting in this case. The behavior of the BulkAttributeRenamer in FME 2015 is the same as the Mode "Rename" in 2016.