Skip to main content
Question

How to access a Published Parameter from a Python startup script

  • February 3, 2017
  • 2 replies
  • 244 views

Forum|alt.badge.img

In a Python startup script, I want to access Published parameters (to test whether an Oracle non-spatial Source Dataset connection is to our test or production environment). But the only examples I'm seeing in the documentation are for TCL startup scripts. If anyone has an example of accessing published parameters in a Python startup script that would be very helpful.

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.

2 replies

takashi
Celebrity
  • February 3, 2017

Hi @ieukcoca, you can access a user parameter through fme.macroValues dictionary. e.g.

import fme
value = fme.macroValues['PARAM'] # Fetch the value of a user parameter called PARAM.

See these pages to learn more about the fme module use.

FME Workbench | Startup and Shutdown Python Scripts

Alternatively, a built-in global dictionary called FME_MacroValues can also be used.

value = FME_MacroValues['PARAM']

Forum|alt.badge.img
  • Author
  • February 3, 2017

Hi @ieukcoca, you can access a user parameter through fme.macroValues dictionary. e.g.

import fme
value = fme.macroValues['PARAM'] # Fetch the value of a user parameter called PARAM.

See these pages to learn more about the fme module use.

FME Workbench | Startup and Shutdown Python Scripts

Alternatively, a built-in global dictionary called FME_MacroValues can also be used.

value = FME_MacroValues['PARAM']
Thanks! Worked great.