First - I’ve searched through the forums and found a few related posts but am still lost on my issue.
It’s a lot of code so I won’t be posting the whole script, I’ll just describe the intent and the different results I’m getting.
Scenario 1: I have a tag that when it changes from a 0 to 1 it will trigger a tag change event. That tag change event simply runs a script from the global library. The script in the library takes 2 arguements: startDate and endDate. Currently the startDate and endDate are being set in the tag change event - I have tried hardcoding those dates in the global script itself as well as trying to use memory tags and just readBlocking from the tags (in the change event and in the global script library).
Scenario 2: Executing that global script from a script console. Also have set those dates in various ways.
The results between Scenario 1 and Scenario 2 are different. The first scenario does return results but they aren’t correct whereas the 2nd scenario always returns the correct results. I can’t seem to figure what variable or even why they would be different. I even tried taking the variables out and hardcoding it - still different results between the tag executing it and the script console.
Any thoughts? Below is what the tag change event code looks like:
if not initialChange and currentValue.value: enable = system.tag.readBlocking(["[.]Enable"]).value if enable: startDate = system.tag.readBlocking(['[default]Rolling Start']).value endDate = system.tag.readBlocking(['[default]Rolling End']).value LinkIds.runLinkUpdate(startDate,endDate)
And the script console:
startDate = system.tag.readBlocking(['[default]Rolling Start']).value endDate = system.tag.readBlocking(['[default]Rolling End']).value LinkIds.runLinkUpdate(startDate,endDate)
The “LinkIds.runLinkUpdate()” uses the dates for several queries and it tries to match rows between the queries based on an index. Again - it works as intended through the script console but through the tag change event it doesn’t work as intended.
The queries are going against 2 different data sources. 1 is a Postgres database and the other is a BigQuery.
I’m thinking this has something to do with the different scopes between a tag change script and the script console. Just not sure how to remedy it.