Skip to main content
Question

From attribute to published parameter

  • August 24, 2016
  • 6 replies
  • 30 views

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

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
Celebrity
  • 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
Celebrity
  • 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.

wow, completely same as David's suggestion :)

 


takashi
Celebrity
  • 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.

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

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

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.