Skip to main content
Question

How to access a Published Parameter from a Python startup script

  • February 3, 2017
  • 2 replies
  • 209 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.

2 replies

takashi
Influencer
  • 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
takashi wrote:

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.

 

 


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