I'm using this python script to update an Environment Variable :
cursor = context.cursor() cursor.execute('select cast(max(right("$path",8)) as int) from eds') max_mill = cursor.fetchone() context.updateVariable('Mill_max_date', max_mill)
After running the script, the Environment Variable (Mill_max_date) value does not update. Is there a better way to update the value permanently?
3 Community Answers
Arawan Gajajiva —
Hi Mehrdad -
The syntax you have provided looks correct for setting the value of a variable from within a Python script. How are you identifying that the variable was not set properly? I’m wondering if there is something else going on in your Orchestration job that might be causing the behavior you are experiencing. For instance, if you add this additional debugging line to the end of your Python script, that should help to verify if the variable was set properly:
Yes, when I use print command, it shows the value of the variable (Mill_max_date) is updated but just for that orchestration job and not permanently. If in another job I call the same variable, It doesn't show the updated value. I'm looking to update the value of the variable permanently so if I called my variable, I can us the updated value every time.
When you update the variable, it will only update for that running job and any other jobs initiated from that job. If you run another job separately or once that job run has completed the variable will fall back to the default.
If you need to update the variable permanently then you need to update the default value via the web interface.