Skip to content

Instantly share code, notes, and snippets.

View countnazgul's full-sized avatar

Stefan Stoichev countnazgul

View GitHub Profile
@countnazgul
countnazgul / extract-master-items.js
Last active April 17, 2022 06:30
[List Qlik Sense master items] List all master dimensions and measures #qlik #qliksense #enigma
const enigma = require('enigma.js');
const WebSocket = require('ws');
const schema = require('enigma.js/schemas/12.170.2.json');
let qlik = {
session: {},
global: {},
doc: {},
details: {
host: 'localhost',
@countnazgul
countnazgul / QlikView_Julian_Date_Conversion.qvs
Last active April 17, 2022 06:34 — forked from ralfbecher/QlikView_Julian_Date_Conversion.qvs
[Julian Date to normal Date] Convert from Julian Date to normal Date (Gregorian) #qlik #qlikview #script
// to convert from Julian Date to normal Date (Gregorian)
// subtract the offset 2415019 (equivalent to 30.12.1899, which is day 0 in QlikView):
Date(JulianDateField - 2415019)
//You probaly have to adjust the timezone since Julian Date is in UTC.
// to convert from normal Date (Gregorian) to Julian Date
// add the offset 2415019 (equivalent to 30.12.1899, which is day 0 in QlikView):
@countnazgul
countnazgul / NULLINTERPRET
Last active April 17, 2022 06:34
[Use Null values in Qlik] #qlik #qliksense #qlikview #script
SET NULLINTERPRET=NULL;
Orders:
LOAD * INLINE [
OrderID, OrderDate
112233, 1/2/2008
223344, 2/2/2008
334455, NULL
445566, NULL
556677, 3/3/2008
@countnazgul
countnazgul / generate-previous-months
Last active April 17, 2022 06:36
[Generate all previous months] For each month in the given months list, generate all previous months #qlik #qliksense #qlikview #script
Raw:
Load * Inline [
Month
2014-01
2014-02
2014-03
2014-04
2014-05
];
@countnazgul
countnazgul / Create Master Item Visualisation.js
Last active April 17, 2022 18:31
[Create master visualisation item] #qlik #qliksense #enigma
// The idea is to create a master item visualisation from
// an existing dashboard object
// If the requirement is to create a master item from json (exported from another app)
// the first step is to create the source object first and the use it
// to create the master item and then drop the source (if needed)
// Create empty object with type of masteritem
let myMasterItem = await qDoc.createObject({
"qInfo": {
"qId": "my-id",
@countnazgul
countnazgul / Qlikview_mixed_security_access
Last active April 17, 2022 18:31
[Mixed (NTNAME and User/Pass) in section access] #qlik #qlikview #qliksense #script
Section Access;
LOAD * INLINE [
ACCESS, USERID, PASSWORD, NTNAME
ADMIN , admin , admin , *
USER , * , * , DOMAIN\USERNAME
];
Section Application;
@countnazgul
countnazgul / qv-months-diff-count
Last active April 17, 2022 18:32
[Calculate number of months diff between dates] #qlik #qlikview #qliksense #script
= ((year(vDate2)*12)+month(vDate2)) - (((year(vDate1)*12)+month(vDate1)))
@countnazgul
countnazgul / QlikView_Convert_into_Unix_Timestamp.qvs
Last active April 17, 2022 18:34 — forked from ralfbecher/QlikView_Convert_into_Unix_Timestamp.qvs
[Convert to Unix timestamp] #qlik #qlikview #qliksense #script
LET t1 = (num(timestamp#('2013-01-11 18:00:00', 'yyyy-mm-dd hh:mm:ss')) - 25569) * 86400;
LET t2 = (num(Now(1) - 25569) * 86400;
@countnazgul
countnazgul / git clone only specific branch
Last active April 17, 2022 18:35
[Clone specific branch] #terminal #git
git clone user@git-server:project_name.git -b branch_name /some/folder
@countnazgul
countnazgul / mongodb-batch-update.js
Last active April 17, 2022 18:36
[Batch update records] #mongo
// OrderId = [1,2,3,4,5,6]
BulkUpdate(OrderId, function() {
console.log('done');
});
function BulkUpdate(OrderId, callback) {
Model.update(
{ orderid : { $in: OrderId } },
{ $set: { status: 'complete' } },