Retaining Global Variable Value

Hello,

I want to retain my global variable defined in script module after I close the client application and re-run
the same application.

Can somebody help me on this??

Thanks,
Ashish

Is there some reason you aren’t saving this value in a database or to a tag?

Hi Ashish,

You cannot directly retain global variables after closing a client because those global variables are gone at that point.

But you can save the values to various places before closing the client and then restore your global variables on client startup. In theory (because I haven’t tried it myself) there is a Client Shutdown-Intercept Script and Client Shutdown Script that you can use to store your global variable values to a database or memory tags.

You can use a Client Startup script to retrieve values from memory tags or the database and store them in your global variables.

I almost never use Python global variables in Ignition because instead I just store data in a database or SQLTags.

Do you have a special case where you can’t store your data to a database or SQLTags?

Hello All,

Thanks for help. It worked for my requirement.