Skip to main content

Variables

Variables used

A variable has to be created before the application is being published. After an application has been published in Qlik Sense Server, only session variables can be created. A variable has to be created before the application is being published, If an app has been published in Qlik Sense Server you can only use session variables. A session variable lives and dies within the session.

Note: Session variables are never listed in VariableList.

Create

  • CreateVariableEx

Get

  • GetVariableById

  • GetVariableByName

  • GetVariableList

Destroy

  • DestroyVariableById

  • DestroyVariableByName

Session Variables

  • CreateSessionVariable

  • DestroySessionVariable

Scenario:

Example:  

private IVariable CreateVariable(IApp myApp)
{
	return myApp.CreateVariableExpression(null,new VariableProperties
	{
		Name = "Sales2012",
		Definition = @"=Year(Today())-3"
	});
}

Example:  

private IVariable CreateSessionVariable(IApp myApp)
{
	return myApp.CreateSessionVariable(null, new VariableProperties
	{
		Name = "Sales2011",
		Definition = @"=Year(Today())-4",
	});
}
		

The following variables are obsolete and will be removed within a year

  • CreateVariable

  • GetVariable

  • RemoveVariable

  • SetFavoriteVariables

  • GetFavoriteVariables