{{ message }}

Instantly share code, notes, and snippets.

# Ralf Becher ralfbecher

Created Dec 14, 2016
Qlik Nice Number Format
View Qlik_Nice_Number_Format.qvs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 //---------------------------------------------- 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, ))))) &
Created Dec 16, 2015
QlikView Haversine formula calculation
View QlikView_Haversine_formula.qvs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 // calculation of distance of two geo references (lat/lon): = 12742 * atan2(sqrt(sqr(sin(((lat2-lat1)*PI()/180)/2)) + (cos(lat1*PI()/180) * cos(lat2*PI()/180)) * pow(sin(((lon2-lon1)*PI()/180)/2),2)), sqrt(1 - (sqr(sin(((lat2-lat1)*PI()/180)/2)) + (cos(lat1*PI()/180) * cos(lat2*PI()/180)) * pow(sin(((lon2-lon1)*PI()/180)/2),2))))
Last active Mar 6, 2021
Generic load example from QlikView Reference Manual with table consolidation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 // generic load with one consolidated resulting table: InputTable: LOAD * INLINE [ object,attribute,value ball,color,red ball,diameter,10 cm ball,weight,100 g box,color,black box,height,16 cm box,length,20 cm
Last active Feb 6, 2021
Golang get Snowflake QueryID out of *sql.Rows
View getSnowflakeQueryID.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 import ( "context" "database/sql" "database/sql/driver" "errors" "reflect" // ... sf "github.com/snowflakedb/gosnowflake" )
Created Feb 6, 2018
Qlik Sense Mashup with Enigma.js - the official way
View mashupEnigmaRequire.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 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" });
Last active Mar 30, 2019
JavaScript function to create a Date from QlikView or Qlik Sense numerical Date value
View dateFromQlikNumber.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 function dateFromQlikNumber(n) { var d = new Date(Math.round((n - 25569) * 86400000)); // since date was created in UTC shift it to the local timezone d.setTime(d.getTime() + d.getTimezoneOffset() * 60000); return d; }
Last active Aug 9, 2018
Calculate Benford's Law in QlikView
View QlikView_Calculate_Benford_s_Law.qvs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 //QlikView Script, Load the distribution of first digits, according to Benford's law, as Data Island: Benford: LOAD FirstDigit, log10(FirstDigit+1) - log10(FirstDigit) as OccurancePct; LOAD RecNo() as FirstDigit AutoGenerate(9); //*********************************************************************************** //Chart //Dynamic Dimension; =ValueList(1,2,3,4,5,6,7,8,9)
Created Aug 21, 2015
QlikView color code for temperature in Celsius
View QlikView_color_code_temperature_Celsius.qvs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 // calculates hue for temperature from -30 to +30 °C: hsl((30 + 240 * (30 - max({} Temp)) / 60) / 255, 0.75, 0.9)
Created Sep 10, 2013
Unnest dynamic amount of data stored in field value using LOAD While:
View QlikView_Unnest_Field_Data_While.qvs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 // unnest data of field value: Input: LOAD * INLINE [ ACCOUNT, SUPPLIES 001, "Apples,Bananas,Tomatos" 002, "Bread,Butter,Cheese" 003, "Pretzel,Wuerstl" ]; Result:
Created Sep 11, 2013
Create a list of values variable for the usage in a SQL Where IN-Clause.
View QlikView_List_of_Values_Variable.qvs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 Companies: LOAD * INLINE [ Company CompanyA CompanyB CompanyC ]; List: LOAD