Question

How to access a Published Parameter from a Python startup script

  • 3 February 2017
  • 2 replies
  • 50 views

Badge

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

Userlevel 2
Badge +17

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']
Badge

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.

 

 

Reply