Field API
This API is reliable and breaking changes are unlikely.
qlik.app.field
The qlik.app.field method is the entry point to the Field API. It returns a QField object with methods and properties that can be used to manipulate the field.
See: field method
Version history
Introduced | 1.0 |
Getting started
You must first connect to the Qlik Sense app, and you do this with the qlik.openApp method. You then use the qlik.app.field method to get a field reference with methods that can be used to manipulate the field.
var config = {
host: window.location.hostname,
prefix: prefix,
port: window.location.port,
isSecure: window.location.protocol === "https:"
};
require(["js/qlik"], function(qlik) {
// open the app
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d', config);
//get a field reference and clear the field selection
var lastNameField = app.field('LastName');
lastNameField.clear();
});
Version history
Each method and property contain information around when it was introduced, updated, deprecated or removed. A list of all relevant API changes per version release can be found in API version history.
Examples of use
Learn what you can do with the Field API.
Select values in a field
Use the app.field.selectValues method to select specific values in a field.
Example 1: Using standard syntax
var config = {
host: window.location.hostname,
prefix: prefix,
port: window.location.port,
isSecure: window.location.protocol === "https:"
};
require(["js/qlik"], function(qlik) {
// open the app
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d', config);
// select values - standard syntax
app.field('LastName').selectValues([{qText: "Jones"},{qText: "Bush"},{qText: "Obama"}], true, true);
});
Example 2: Using simplified syntax
var config = {
host: window.location.hostname,
prefix: prefix,
port: window.location.port,
isSecure: window.location.protocol === "https:"
};
require(["js/qlik"], function(qlik) {
// open the app
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d', config);
//select values - simplified syntax
app.field('LastName').selectValues(["Jones"], true, true);
});
Clear field selections
Use the app.field.clear method to clear a field selection.
var config = {
host: window.location.hostname,
prefix: prefix,
port: window.location.port,
isSecure: window.location.protocol === "https:"
};
require(["js/qlik"], function(qlik) {
// open the app
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d', config);
//get a field reference and clear the field selection
var lastNameField = app.field('LastName');
lastNameField.clear();
});
The app.field.clearOther method clears all fields except the selected one.
var config = {
host: window.location.hostname,
prefix: prefix,
port: window.location.port,
isSecure: window.location.protocol === "https:"
};
require(["js/qlik"], function(qlik) {
// open the app
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d', config);
//clears all fields except the selected one
app.field('LastName').clearOther(true);
});
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 – let us know how we can improve!