create method

Note: STABLE.
This API is reliable and breaking changes are unlikely.

qlik.app.variable.create(qProp)

Creates a variable.

Note: A new implementation of the create method was introduced in version 2.1. The legacy implementation of the method will continue to work but it is recommended to use the new implementation.

Version history

Introduced 1.0
Updated 2.1

Parameters

Name Type Description
qProp String | Object

Variable name or properties. Properties:

Name Type Description
qInfo.qId String

Optional.

Variable id.

If the selected ID is already in use, a new ID is automatically set by the engine.

qName String

Variable name.

The name must be unique.

qComment String

Optional.

Comment related to the variable.

qDefinition String

Optional.

Variable definition.

qNumberPresentation Object

Optional.

Defines the format of the value.

qIncludeInBookmark Boolean

Optional.

Set to true to update the variable when applying a bookmark. The variable value will be persisted in the bookmark.

Returns

Returns a promise of a variable model.

Tip: For more information regarding a promise, see https://code.angularjs.org/1.6.9/docs/api/ng/service/$q#the-promise-api.

Examples

Example: Current implementation - object

var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d');
	app.variable.create({qName : 'myvar', qDefinition: 'Month'});
Name Type Description
Name String

Did this information help you?

Thanks for letting us know. Is there anything you'd like to tell us about this topic?

Can you tell us why it did not help you and how we can improve it?