Skip to main content
Archived

Global Variable Initialization in Startup Process

Related products:FME Form
  • November 7, 2015
  • 6 replies
  • 34 views

takashi
Celebrity
Add a Python/Tcl function which defines a global variable with initial value, so that the user can call the function in Startup Python/Tcl script.
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

fmelizard
Safer
Forum|alt.badge.img+22
  • Safer
  • November 7, 2015
The underlying FME Engine can give an initial value to a GlobalVariable so it would seem we could find a way to do this.

takashi
Celebrity
  • Author
  • November 8, 2015

I think so. It would be convenient in some cases. Thanks.


david_r
Celebrity
  • November 9, 2015
You can currently do this manually by declaring a global object e.g. in the startup Python script. However, if your workspace contains a Python-based transformer (I'm looking at you, StatisticsCalculator!), then the Python interpreter gets re-initialized when the first feature hits it, and your global objects are all gone...

 

 

Having fmeobjects access to the variables in the VariableSetter/VariableRetriever would be nice.

takashi
Celebrity
  • Author
  • November 9, 2015

@david_r, thanks for the tip. I sometimes use Python global variables, but it doesn't have compatibility with FME global variable, and also my loving Tcl doesn't support workspace-wide global variable unfortunately. My dream is to use a workspace-wide global variable which is compatible among all of FME, Python and Tcl ;)


takashi
Celebrity
  • Author
  • November 9, 2015

It reminded me. You can fetch a global variable value in a PythonCaller.

v = feature.performFunction('@GlobalVariable(aVariable)')

 

Tcl has also a built-in function called "FME_Execute" to execute an FME Function. FYI.


david_r
Celebrity
  • November 9, 2015

Excellent, thanks!