Skip to content
+1-888-319-3663

COMMUNITY FORUM

Simple task of updating a global variable

Brandon Aronson asked 2 years ago
Hello, 
I am attempting to update a global variable to “HELLO” inside of a script that runs as a pre-task before the map.
For testing, I created a global variable called GBL_SBLLATESTPULL.  In my map, I have a task with a script, simply as 
GBL_SBLLATESTPULL=”HELLO”
My map executes without error, but when I go into the global variable defaults on the map tasks, it is blank.  I’m sure what I am doing wrong is extremely simple, but I am kind of stuck.
Any help would be appreciated, thank you.
Answers
Patrick Roth Staff answered 2 years ago
“I’m sure what I am doing wrong “

Good news isn’t that you are doing anything wrong – you just have differing expectations on what should be happening.
When you set a global variable in code, it doesn’t re-set the “stored value” (from the MapVariable table in SC db).
Instead the map defaults to whatever the map global variable is set to and then in code you change that “working” value or read from it in code however you want.

But when the map execution is finished and you restart the map again, the global is still going to be set to whatever it defaulted to from the Map Globals tab.
If you want a variable that is updated if you set it you would either want to:
1. make your own custom sql table and update it in your own table
2. investigate updating the MapVariable table yourself via a SQL task
patrick
Brandon Aronson answered 2 years ago
Patrick thank you very much for your response, that makes perfect sense to me.  I will start tracking these items in a SQL table

If you would like to submit an answer or comment, please sign in to the eOne portal.