Skip to main content
Question

From attribute to published parameter


Forum|alt.badge.img

I have a project wich produced a parameter I need in the shutdown python script. The problem is I cannot use it. Maybe I can but I don't know the protocole.

A solution would be to "send" the attribute into a published parameter and then use the published parameter into the python script.

But I dn't know how to do the "send" in this scenario.

Any ideas?

FYI : the attribute become a published parameter in a following workspace. Maybe I can catch it from there.

6 replies

david_r
Celebrity
  • August 24, 2016

It is not possible to modify the contents of private or published parameters while the workspace is running.

A possible solution could be to use a PythonCaller in your workspace to store feature attributes in a global object (e.g. a list or a dictionary), then reference the same global object in your shutdown script.


takashi
Evangelist
  • August 24, 2016

Hi @slerendu, published/private user parameters are configured before starting translation and you cannot set/change them in the translation process unfortunately. A workaround is to define a Python global variable with a PythonCaller. The global variable can be used in Shutdown Pyhon script.


takashi
Evangelist
  • August 24, 2016
takashi wrote:

Hi @slerendu, published/private user parameters are configured before starting translation and you cannot set/change them in the translation process unfortunately. A workaround is to define a Python global variable with a PythonCaller. The global variable can be used in Shutdown Pyhon script.

wow, completely same as David's suggestion :)

 


takashi
Evangelist
  • August 24, 2016
takashi wrote:

Hi @slerendu, published/private user parameters are configured before starting translation and you cannot set/change them in the translation process unfortunately. A workaround is to define a Python global variable with a PythonCaller. The global variable can be used in Shutdown Pyhon script.

Example

 

# PythonCaller Script
def processFeature(feature):
    global value
    value = feature.getAttribute("attr")
# Shutdown Python Script
print value

Forum|alt.badge.img
  • Author
  • August 24, 2016
david_r wrote:

It is not possible to modify the contents of private or published parameters while the workspace is running.

A possible solution could be to use a PythonCaller in your workspace to store feature attributes in a global object (e.g. a list or a dictionary), then reference the same global object in your shutdown script.

It works fine. Thanks both of you.

 

 


Forum|alt.badge.img
  • Author
  • August 24, 2016
takashi wrote:

Hi @slerendu, published/private user parameters are configured before starting translation and you cannot set/change them in the translation process unfortunately. A workaround is to define a Python global variable with a PythonCaller. The global variable can be used in Shutdown Pyhon script.

It works fine. Thanks both of you.

 

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings