Skip to main content

Hello,

I have a .cal file saved in python to create a unique identifier. How can I use this in FME? I didn't create this so I don't know how to tie this to the field needed.

In Arcmap I could just right click the field I want this to go in and field calculate it, but how would I use this to update attributes with nulls in a specific field within fme.

 

import uuid

def f():

 

return "{" + str(uuid.uuid4()).upper() + "}"

__esri_field_calculator_splitter__

f()

 

 

 

 

I believe the PythonCaller transformer could call this script.


In a PythonCaller you can do:

import uuid
def FeatureProcessor(feature):
    value = uuid.uuid4()
    feature.setAttribute('my_uuid', '{%s}' % value)

This will add the attribute 'my_uuid' to every feature that passes through.

 


Ended up using UUID generator instead of the python script in combination with Attributemanager.


Reply