Skip to content

Instantly share code, notes, and snippets.

View erikwett's full-sized avatar

Erik Wetterberg erikwett

View GitHub Profile
addons: {
uses: "addons",
items: {
dataHandling: {
uses: "dataHandling",
items: {
rowCount: {
ref:'qHyperCubeDef.qInitialDataFetch.0.qHeight',
type:'integer',
label: 'Row count',
@erikwett
erikwett / initialProperties.js
Created October 5, 2018 07:22
Qlik Sense initialProperties with initialDataFetch
initialProperties: {
qHyperCubeDef: {
qDimensions: [],
qMeasures: [],
qInitialDataFetch: [{
qWidth: 20,
qHeight: 500
}]
}
}
@erikwett
erikwett / start_task.js
Created August 22, 2018 14:51
Start Qlik Sense task
function startReload(taskid) {
return qlik.callRepository('/qrs/task/' + taskid + '/start', 'POST').then(function(reply) {
console.log('start task', reply);
});
}
@erikwett
erikwett / create_task.js
Last active August 22, 2018 14:47
Create Qlik Sense reload task from javascript
function createTask(appid, appname){
qlik.callRepository('/qrs/ReloadTask', 'POST', {
app: {
id: appid
},
enabled: true,
name: "Reload " + appname,
maxRetries: 5
}).then(function(reply){
console.log('Task created',reply);
@erikwett
erikwett / property_panell_add_to_measure.js
Created July 17, 2018 14:16
Add your own property to the built-in measure property
measures: {
uses: "measures",
min: 1,
max: 6,
items: {
type: {
ref: "qDef.type",
type: "string",
label: "Type",
component: "dropdown",
@erikwett
erikwett / property_panel_dropdown_custom.js
Last active July 17, 2018 08:02
Qlik Sense extension: property panel dropdown with custom alternative
width: {
type: 'string',
component: 'dropdown',
label: 'Width',
ref: 'width',
options: [{value: '', label: 'Default'},
{value: 'fill', label: 'Fill'},
{value: 'custom', label: 'Custom'}]
},
customwidth: {
@erikwett
erikwett / gist:256e52ece04dfce2dbbacf543d85c029
Last active July 17, 2018 07:46
property_panel_expression_always.js
width: {
type: 'string',
ref: 'width',
label: 'Width',
expression: 'optional'
}
@erikwett
erikwett / create_alt_state.js
Last active April 26, 2018 16:26
Property panel code to add an alternate state
addstate: {
ref: "statename",
label: "Add state",
type: "string",
change: function (data) {
if(data.statename){
qlik.currApp().addAlternateState(data.statename);
}
}
}
@erikwett
erikwett / add_alt_state_dropdown.js
Last active April 26, 2018 10:06
Alternate state field as a dropdown
state: {
ref: "qHyperCubeDef.qStateName",
label: "State",
type: "string",
defaultValue: "$",
component: "dropdown",
options: function () {
return qlik.currApp(this).getAppLayout().then(function (a) {
return a.layout.qStateNames.concat('$').map(function (state) {
return {
@erikwett
erikwett / add_alt_state.js
Last active April 26, 2018 09:42
Add alternate state to Qlik Sense property panel
addons: {
uses: "addons",
items: {
advanced: {
label: "Advanced",
type: "items",
items: {
state: {
ref: "qHyperCubeDef.qStateName",
label: "State",