Skip to main content
Question

Using a global or static variable in TCLCaller

  • May 6, 2014
  • 1 reply
  • 41 views

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

 

 

}

 

 

 

1 reply

takashi
Influencer
  • May 6, 2014
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

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