Skip to main content Skip to complementary content

Working with 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.

Information noteSession 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

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!