Public Variables

Hi,

perhaps this is a simple question but I didn’t find the solution.

I use this script to declare my variables:

var teamA="myTeam"; var teamB="yourTeam"; var And what I want to do is when I click on my button I would like my variables update. So here is my script. / %const['globVars']['vars']%; teamA="TEAM A"; teamB="TEAM B"; ogscript.debug(teamA); ogscript.debug(teamB); But debug always return "myTeam" and "yourTeam" and not "TEAM A" and "TEAM B".

How can I proceed please ?

Thanks

When you use %const[‘lookup_id’][‘key’]% it is the equivalent of writing that exact string of text in your script. In this case, the script in the button is throwing an exception but that may be a copy/paste issue. If I type:

var teamA="myTeam"; var teamB="yourTeam"; (remove the extra "var" at the end)

and remove the “/” at the start of:

%const['globVars']['vars']%; teamA="TEAM A"; teamB="TEAM B"; ogscript.debug(teamA); ogscript.debug(teamB); I do get "TEAM A" and "TEAM B" printed.

That said, I strongly-recommend you reconsider your approach here. Using look-ups to store blocks of script was a common approach before the tag was created. Now that it exists, you are better-off declaring your common code and variables in one of those tags and working with them directly.

var teamA=“myTeam”;
var teamB=“yourTeam”;

teamA=“TEAM A”;
teamB=“TEAM B”;
ogscript.debug(teamA);
ogscript.debug(teamB);

#DashBoard

Sorry James, I write my script directly in the post and I make mistake.

But you understood what I try to do.

So now I go to change my approach to declare variables, and use tag for this.

I try it and it works good.

Thanks a lot.
#DashBoard