Skip to main content
I haven't seen a simple answer to this elsewhere, so documenting this here.  I know very little TCL but this works.

 

 

You need to declare the global variables BEFORE the function definition within the TCLCaller, then declare the variable as 'global' within the function.

 

 

eg.

 

-----------------------------------------------------------------------------------------

 

variable term

 

set term 1

 

 

proc MyFunction {} {

 

 

  global term

 

 

 

  FME_LogMessage fme_inform "term = $term"

 

  set term > expr $term + 1 ]

 

 

  # Set NEW attribute like this ..

 

  return $term

 

 

}

 

 

 

Hi,

 

 

Thank you for sharing the tips. I confirmed it works as a global variable which is common to multiple TclCallers in a workspace. But it's not common to Startup and Shutdown Tcl scripts. This point is different from Python scripts.

 

 

Takashi

Reply