I have two gateways, one set up as development and the other production. They are, essentially, exact copies of each other. I have a boolean that I want to toggle true or false with a button but I want to have the same boolean tag on the other gateway always be the opposite of that. So the pseudo code would be
if gateway = development
set development\[default]boolean = NOT development\[default]boolean
set production\[default]boolean = NOT development\[default]boolean
if gateway = production
set production\[default]boolean = NOT production\[default]boolean
set development\[default]boolean = NOT production\[default]boolean
I know how to read the gateway the client is on. What I don’t know is how to access the tag on the other gateway. I don’t want to use a remote tag provider pointing from one gateway to the other because when I migrate from development to production thats just one more manual change I have to make. I’d like to find a way to make this script generic so it doesn’t care what gateway it lives on.
Is there a way to use system.tag.readBlocking or readAsynch to read a tag on another gateway?
You should be using a file that lives outside the data/ hierarchy (so it won’t be in a gateway backup) that contains that kind of information. Or an environment variable. Read it at gateway startup and write the tag.
If you are writing it to a memory tag to make it available throughout the gateway, I don’t see why you can’t overwrite it. (But note that edits to the project containing the startup script will make it execute again.)
(Environment variables are static. And only readable at the gateway. Vision clients and the designer wouldn’t have access.)
Think we lost each other. I have two gateways, each gateway needs to know the state of its own boolean and the one on the other gateway. I need both gateways to be able to toggle their own and then write to the remote gateway to modify its tag as well.
Ah, missed the live sync. You’ll probably need to use WebDev to expose a way to have one gateway call the other. Or put them in a gateway network together and message to each other. Writing from two directions tends to be racy, though.