Forum Discussion
FrancescoBerio-
4 years agoCommunity Member
Sum many text variables in one variable
Hi everybody,
let's say I have 10 different text variables in my project (Q1, Q2, Q3, etc). I would like to obtain a single text variable out of them (result="Q1+Q2+Q3+, etc"). Is that possible? m...
DavidSchwartz-f
4 years agoCommunity Member
Hi Francesco,
I'm far from expert in Javascript, but this approach does work. Below, variables Q1, Q2, Q3, and Q4 are text variables in Storyline. Their values are put into new Javascript variables, and in the last line of the Javascript, those are being concatanated with spaces between them and placed into the variable Totals, which is another Storyline text variable in this example.
var player = GetPlayer();
var jsQ1 = player.GetVar("Q1");
var jsQ2 = player.GetVar("Q2");
var jsQ3 = player.GetVar("Q3");
var jsQ4 = player.GetVar("Q4");
player.SetVar("Totals", jsQ1+" "+jsQ2+" "+jsQ3+" "+jsQ4)
Related Content
- 12 months ago
- 12 months ago
- 12 months ago
- 12 months ago
- 12 months ago