Name | Variables |
Benefit | Remember audience/teams/sessions decisions. |
Key Features | Set/increment/decrement variables for audience, team or session. Also possible to change variable by smartword. |
How To Create a Variable
- Right-click any question
- select "Add Calculation" from the right-click menu
![](https://tw-desk-files.teamwork.com/i/406254/attachment-inline/188074.20180515141950900.188074.20180515141950900GGvSU.png)
Using Variables
Variables can be used in your project with Question types like Case & Condition and with content channels like Graph.
You can also use them with smartwords inside your content.
For example, if you create a variable called "my_score", you can publish it's value by writing the variable name in curly brackets. That's these ones: { }
For example:
Use {my_score} for player variables
Use {team.my_score} for team variables
Use {session.my_score} for session variables
I'm an advanced author, give me more detail!
You only need to know the following if you're an advanced author working with formulas.
Variables are stored in the array partition.variables[]
The three entities, audience, team and session are identified in the index by a suffix - a. for audience t. for team and s. for session.
You have two different ways to access the value of the variable:
Using a formula:
Use |partition.variables[CONCAT("{entity suffix}.",{entity it},".{variable name}")]|
The entity id for each entity is:
- audience.hash
- audience.participant_team_id
- partition.current_session_id
For example, to access the audience attribute "my_score" the formula is |partition.variables[CONCAT("a.",audience.hash,".my_score")]|
To access the team attribute team_decision the formula is |partition.variables[CONCAT("t.",audience.participant_team_id,".team_decision")]|
And example session variable would be |partition.variables[CONCAT("s.",partition.current_session_id,".progress")]|
Always use the entity suffix and variable name in quotes as shown above.