Variables

Appzio Variables


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302

One of the key concepts in Appzio is variables. Variables are key – value pairs bound to the user and used to store different data. They are used all around the platform – from storing credentials, to storing additional user data, to storing the current registration phase for the user. Variables can’t collide, so unless explicitly specified you will always access and save the variables for the current application user.

getSavedVariable


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302

Looks up and returns the value of a variable for the current user. This method only looks for variables in the database.

Available Parameters

varname

Name of the variable

default

Default: false | Value that should be returned if the variable is not found

Example


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302
// Get the current registration phase
$this->getSavedVariable('reg_phase')

getSubmitVariable


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302

Looks up and returns a variable. Will only look in the submitted variables in the submitvariables array. If not found by name, it will get the variable id and look for that – again in the submitvariables. If not found then it will return false.

Available Parameters

varid

Identifier of the variable

Example


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302
// Get the submitted email value
$this->getSubmitVariable('email');

getVariable


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302

Looks up and returns a variable. This method will search both in the submitted variables and in storage. If you know where the variable is stored the best practice is to use the corresponding method for that.

Available Parameters

varid

Identifier of the variable

Example


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302
// Get the name variable
$this->getVariable('name');

getVariableId


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302

If the variable exists in the database it will be submitted with it’s ID as it’s key. This method returns the ID of the variable based on it’s name.

Available Parameters

varname

The variable name

Example


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302
// Get the email variable's id
$id_email = $this->getVariableId('email');

// Get the submitted email variable by it's id
$email = $this->getSubmitVariable($id_email);

getSubmittedVariableByName


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302

This method will look for a variable in the submitvariables array. It will look both for a variable with this name, or use getVariableId() under the hood to find it. Returns default value if it doesn’t.

Available Parameters

varname

The variable name

default

Default: false | Default return value if variable is not found

Example


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302
// Will look for the email variable in the submitted vars
$this->getSubmittedVariableByName('email');

requireVariable


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302

Will look for a variable in the submitvariables and the database. Accepts an error message as a second argument, throws a default one if not given one.

Available Parameters

varname

The variable name

customerror

Default: false | Custom error message if variable is not found

Example


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302
// Get the email variable or an error message if it's not found
$this->requireVariable('email', 'The email is required.');

getArrayOfPlayvariables


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302

Returns an array of all variables for a particular user. Used when displaying user data.

Available Parameters

playid

The user id

Example


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302
$vars = AeplayVariable::getArrayOfPlayvariables($this->playid);

loadVariableContent


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302

Loads all variables for the currently logged user into the varcontent property. Uses getArrayOfPlayvariables with the current user’s id.

Example


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302
$this->loadVariableContent()

saveVariable


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302

Save a variable in the database for the currently logged user.

Available Parameters

variable

The variable name

value

The variable value

Example


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302
$this->saveVariable('email', $this->getSubmitVariable('email'));

deleteVariable


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302

Delete a variable for the currently logged user.

Available Parameters

varname

The variable name

Example


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302
$this->deleteVariable('token');

addToVariable


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302

Variables are often used to store JSON encoded data like settings or additional user information. This method allows you to push items to that array. The platform expects this variable to be an array, if it’s empty or it is a regular string it will be overwritten.

Available Parameters

variable

The variable name

value

The variable value

Example


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302
$this->addToVariable($jsonVariable, $item);

removeFromVariable


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302

Removes an item from the variable. The platform expects the variable to be a JSON encoded array.

Available Parameters

variable

The variable name

value

The value that is to be removed

Example


Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 301

Deprecated: Function create_function() is deprecated in /var/www/docs.appzio.com/public/wp-content/plugins/wp-gfm/markdown.php on line 302
$this->removeFromVariable($jsonVariable, $value);