Skip to main content

Hello,

The problem is, I have a shutdown python script but I need the value of an output parameter, there's any way to know the value of that parameter "Division" with python?

Not quite sure I understand... Do you need to acces the value of attribute "Division" from e.g. a PythonCaller? If so:

my_division_value = feature.getAttribute('Division')

Not quite sure I understand... Do you need to acces the value of attribute "Division" from e.g. a PythonCaller? If so:

my_division_value = feature.getAttribute('Division')
I'm new with python scripting in fme, with this said... yes, I need the value of attribute "Division" but I don't know if I need to use a PythonCaller or can be done without using the PythonCaller?

 

 


I'm new with python scripting in fme, with this said... yes, I need the value of attribute "Division" but I don't know if I need to use a PythonCaller or can be done without using the PythonCaller?

 

 

Getting the value is the easy part, but what is it exactly that you want to accomplish? Knowing more would be helpful. But yes, basically you need the PythonCaller.
Getting the value is the easy part, but what is it exactly that you want to accomplish? Knowing more would be helpful. But yes, basically you need the PythonCaller.
ok, what I want to accomplish is to write a file with the value of the translation status (FAILED, SUCCESSFUL) and the value of the attribute "Division". My workspace starts with a SQL Creator and I don't know if this is important but one of the start parameters is "Division" and is the same value 'til the output, so I can get the value at the beginning or when the translation ends.

 


Thanks for the supplemental info. So you already know how to write a file with the translation status (see here).

The second part is how to "transfer" the value of a feature attribute into the shutdown script. We can use a Python global variable for that. Insert a PythonCaller just before the writer:

def GetDivisionValue(feature):
    global MY_GLOBAL_DIVISION_VALUE
    MY_GLOBAL_DIVISION_VALUE = feature.getAttribute('Division')

Then in the shutdown script, you can retrieve the global variable like this:

global MY_GLOBAL_DIVISION_VALUE
print "The Division value was:", MY_GLOBAL_DIVISION_VALUE

As it is, I assume that only a single feature will be written to Voting...-something writer.


Reply