Skip to main content

Hi,

Bit of on odd one i cannot work out. I have some tabular data e.g.

203040325

The headers are 20,30,40 with values 3,2,5.

Is there a simple oway to end up with

20304020,20,2030,3040,40,40,40,40

Thanks

Try the following in a PythonCaller:

import fmeobjects

def multiply(feature):
    attr_names = feature.getAllAttributeNames()
    for attr in attr_names:
        if attr.isdigit():
            value = int(feature.getAttribute(attr))
            result = ','.join((attr] * value)
            feature.setAttribute(attr, result)

Reply