Skip to content

Instantly share code, notes, and snippets.

Ralf Becher ralfbecher

View GitHub Profile
@ralfbecher
ralfbecher / mashupEnigmaRequire.js
Created Feb 6, 2018
Qlik Sense Mashup with Enigma.js - the official way
View mashupEnigmaRequire.js
var prefix = window.location.pathname.substr(0, window.location.pathname.toLowerCase().lastIndexOf("/extensions") + 1);
var config = {
host: window.location.hostname,
prefix: prefix,
port: window.location.port,
isSecure: window.location.protocol === "https:"
};
require.config({
baseUrl: (config.isSecure ? "https://" : "http://") + config.host + (config.port ? ":" + config.port : "") + config.prefix + "resources"
});
@ralfbecher
ralfbecher / mashupEnigma.js
Created Dec 29, 2017
Qlik Sense Mashup bind Enigma before openApp() is called
View mashupEnigma.js
//
// Bind Enigma before openApp() is called
//
var prefix = window.location.pathname.substr(0, window.location.pathname.toLowerCase().lastIndexOf("/extensions") + 1);
var config = {
host: window.location.hostname,
prefix: prefix,
port: window.location.port,
isSecure: window.location.protocol === "https:"
};
@ralfbecher
ralfbecher / getObjectId.ts
Created Dec 28, 2017
Qlik Sense Extension get right Object Id in all Situations (vanilla, master item, story)
View getObjectId.ts
function getObjectId(scope: any): Promise<string> {
return new Promise((resolve, reject) => {
try {
let objectId: string = "";
if (scope.layout.sourceObjectId) {
// story
objectId = scope.layout.sourceObjectId;
scope.component.model.app.getObject(objectId)
.then( ( obj: EngineAPI.IGenericObject ) => {
obj.getProperties()
@ralfbecher
ralfbecher / Qlik_master_Calendar_DE.qvs
Created Nov 16, 2017
Qlik Master Calendar Script
View Qlik_master_Calendar_DE.qvs
Kalender:
Load
TempDate AS [Issue Datum],
Year(TempDate) As Jahr,
Month(TempDate) As Monat,
monthname(TempDate) as [Monat Jahr],
Day(TempDate) As Tag,
'Q' & ceil(month(TempDate) / 3) AS Quartal,
'Q' & ceil(month(TempDate) / 3) & ' ' & Year(TempDate) AS [Quartal Jahr],
Dual('KW' & Week(weekstart(TempDate)), Week(weekstart(TempDate))) as Woche,
View Qlik_Jira_Time_Formattings.qvs
// Format a time like in JIRA: 4w 3d 06:30
// means: 4 weeks + 3 days (1 day = 8 hrs) + 6 hrs + 30 mins
If(Floor(Sum(AllIssues_fields_aggregatetimeoriginalestimate)/28800)/5 >= 1,
Num(Floor(Floor(Sum(AllIssues_fields_aggregatetimeoriginalestimate)/28800)/5), '#0') & 'w ', '') &
Num(Frac(Sum(AllIssues_fields_aggregatetimeoriginalestimate)/28800/5) * 5, '#0') & 'd ' &
Interval(Frac(Sum(AllIssues_fields_aggregatetimeoriginalestimate)/28800)/3, 'hh:mm')
@ralfbecher
ralfbecher / QlikSenseClassicExtensionDebounceExample.js
Created May 9, 2017
A simple way to debounce in a paint() function of a classic (non-angular) QlikSense extension
View QlikSenseClassicExtensionDebounceExample.js
define([
"jquery",
"qlik",
"underscore"
],
function ($, qlik, _) {
'use strict';
return {
initialProperties: {},
@ralfbecher
ralfbecher / KeepFields.qvs
Created May 1, 2017
Qlik Script Sub KeepFields to Drop mass fields
View KeepFields.qvs
Sub KeepFields(Fields,TableName)
Let n = NoOfFields('$(TableName)');
Set d = #;
For i = 1 to $(n)
Let f = FieldName($(i), '$(TableName)');
If Index('$(Fields)', ',$(f),') = 0 then
If '$(d)' = '#' then
Let d = '$(f)';
Else
Let d = '$(d),$(f)';
View Qlik_Subtract_DST.qvs
//subtract hour from timestamp when DST
=TimeStamp(field - frac(ConvertToLocalTime(field,'Berlin') - frac(field)) + 1/24)
View Qlik_Nice_Number_Format.qvs
//---------------------------------------------- Nice Numberformat simplified ---------------------------------------------
// does work with count in KPI object (have seen several versions from Qlik which haven't worked)
Set vF_NiceNumberSimple =
If(Fabs($1) > 1e9, Num($1/1e9+1e-13, '#$(ThousandSep)##0$(DecimalSep)00')
,If(Fabs($1) > 1e8, Num($1/1e6+1e-13, '##0$(DecimalSep)0')
,If(Fabs($1) > 1e6, Num($1/1e6+1e-13, '##0$(DecimalSep)00')
,If(Fabs($1) > 1e5, Num($1/1e3+1e-13,'##0$(DecimalSep)0')
,If(Fabs($1) > 1e3, Num($1/1e3+1e-13, '##0$(DecimalSep)00')
, $1,
))))) &
@ralfbecher
ralfbecher / wblGen.bat
Last active Sep 7, 2016 — forked from nate-untiedt/wblGen.bat
A simple batch file that automatically generates the wblfolder.wbl for your Qlik Sense visualization extension.
View wblGen.bat
@echo off
REM wblGen.bat - v 1.0.0 - 2015-10-09
REM Description:
REM A simple batch file that automatically generates the wblfolder.wbl for your Qlik Sense visualization extension.
REM
REM Author: Nate Untiedt - Analytics8 - nuntiedt@analytics8.com
REM
REM Credit to: http://stackoverflow.com/a/8387078
setlocal EnableDelayedExpansion
You can’t perform that action at this time.