<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Qlik Sense Tutorials from Quick Intelligence</title>
	<atom:link href="https://www.quickintelligence.co.uk/qlik-sense-tutorials/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description></description>
	<lastBuildDate>Fri, 15 May 2026 14:34:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://www.quickintelligence.co.uk/wp-content/uploads/2017/05/cropped-QuickIntelligence_Square-32x32.png</url>
	<title>Qlik Sense Tutorials from Quick Intelligence</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">48890870</site>	<item>
		<title>Starting External Services From Qlik Sense Load Scripts</title>
		<link>https://www.quickintelligence.co.uk/starting-external-services-from-qlik-sense-load-scripts/</link>
					<comments>https://www.quickintelligence.co.uk/starting-external-services-from-qlik-sense-load-scripts/#respond</comments>
		
		<dc:creator><![CDATA[Steve Dark]]></dc:creator>
		<pubDate>Fri, 21 Nov 2025 15:57:16 +0000</pubDate>
				<category><![CDATA[Qlik Sense Tutorials]]></category>
		<category><![CDATA[IFTTT]]></category>
		<category><![CDATA[Load Script]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[Sense]]></category>
		<guid isPermaLink="false">https://www.quickintelligence.co.uk/?p=1505962</guid>

					<description><![CDATA[<p>We live in an increasingly interconnected world and various systems need to talk to each other to exchange information and to cause events to happen. Webhooks are one of the ways that messages can be sent between systems and this blog post explains how you can put these to work for you in your Qlik  [...]</p>
<p>The post <a href="https://www.quickintelligence.co.uk/starting-external-services-from-qlik-sense-load-scripts/">Starting External Services From Qlik Sense Load Scripts</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>We live in an increasingly interconnected world and various systems need to talk to each other to exchange information and to cause events to happen. Webhooks are one of the ways that messages can be sent between systems and this blog post explains how you can put these to work for you in your Qlik load script.<span id="more-1505962"></span></p>
<h3>Why Call A Webhook?</h3>
<p>In my previous blog post (<a href="https://www.quickintelligence.co.uk/start-a-qlik-sense-cloud-reload-from-a-webhook/">Start a Qlik Sense Cloud Reload from a Webhook</a>) I described how to create a webhook using <a href="https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_QlikAutomation/introduction/home-automation.htm">Qlik Automations</a> which can start a reload of any app in your Qlik Cloud tenant. One of the places you might want to trigger this from is from a Qlik load script. This way you can call a reload of one or more Sense apps at the end of another script, perhaps dependant on data or status.</p>
<p>Triggering a Qlik Automation is one example of why you might want to fire a webhook, but in this post I want to share another example &#8211; raising an alert when things are broken.</p>
<p><img fetchpriority="high" decoding="async" src="https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/Raise-Alert-From-Qlik-Using-A-Load-Script-Webhook-400x224.png" alt="Starting External Services From Qlik Sense Load Scripts" width="400" height="224" class="aligncenter size-fusion-400 wp-image-1505981" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/Raise-Alert-From-Qlik-Using-A-Load-Script-Webhook-200x112.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/Raise-Alert-From-Qlik-Using-A-Load-Script-Webhook-300x168.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/Raise-Alert-From-Qlik-Using-A-Load-Script-Webhook-400x224.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/Raise-Alert-From-Qlik-Using-A-Load-Script-Webhook-600x335.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/Raise-Alert-From-Qlik-Using-A-Load-Script-Webhook-768x429.png 768w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/Raise-Alert-From-Qlik-Using-A-Load-Script-Webhook.png 800w" sizes="(max-width: 400px) 100vw, 400px" /></p>
<h3>How Do You Notify When Your Notifications Are Broken?</h3>
<p>Something we always set up when building customer environments is sufficient notifications to make us aware when anything is wrong. On Qlik Sense Client Managed this is essential, as there is very little out of the box, and on Cloud it needs to be set up space by space, so some things can be missed. Sometimes we are working on a secure site where SMTP relaying from within the site is not permitted. Other times it can be that communication between the Qlik server and the SMTP server is down due to network issues, so the route to let us know there is an issue is broken along with the rest of the network. In these cases we need a way to get a message out, when nothing else is working.</p>
<p>Something that is likely to work in Sense, even when all else is failing, is calling a URL to extract data. If that URL is a webhook then that call can then trigger an action. What we have is a an applet set up in <a href="https://ifttt.com/">IFFTT</a> (If This Then That) which sends an email via GMail containing values from the parameters of the webhook called. I won&#8217;t go into setting up that applet here, as it will be slightly different if you want to use a different mail client or call a different service, but I have given details on this in a previous blog post on <a href="https://www.quickintelligence.co.uk/ifttt-webhooks-qlik-cloud/">Inserting Qlik Capacity Usage Into a Spreadsheet</a>.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505966" src="https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/IFTTT-Gmail-via-Webhook.png" alt="IFTTT Gmail via Webhook" width="400" height="174" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/IFTTT-Gmail-via-Webhook-200x87.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/IFTTT-Gmail-via-Webhook-300x131.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/IFTTT-Gmail-via-Webhook.png 400w" sizes="(max-width: 400px) 100vw, 400px" /></p>
<p>Once you have a webhook set up that can send the notification you are ready to build an app that triggers that webhook when there is a problem.</p>
<h3>Raise a Notification When Files Go Stale</h3>
<p>The most basic measure of everything being up and working is that files that are used by your Qlik environment are all up to date. If the applications you wish to monitor do not currently create any files then it is a simple job to add a <a href="https://www.quickintelligence.co.uk/write-csv-qlikview-store/">STORE</a> statement to write a small text file that can be checked for. The application we shall build here then has an inline table (which will work even if all else is broken) with a list of file locations and how old those files can go before we want to be told about them.</p>
<p>Before building the load script for this app you will need to set up a REST connector that we can pass parameters in to. To do this build a new <a href="https://help.qlik.com/en-US/connectors/Subsystems/REST_connector_help/Content/Connectors_REST/Load-REST-data/Load-data.htm">REST connector</a>, set it to a placeholder URL (I tend to use <a href="https://jsonplaceholder.typicode.com/posts">https://jsonplaceholder.typicode.com/posts</a>), set the type to <strong>GET</strong>, ensure that <strong>Allow WITH CONNECTION</strong> is ticked and give it a name of <strong>Generic GET</strong>.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505968" src="https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/Create-Qlik-REST-Connection.png" alt="Create Qlik REST Connection" width="550" height="141" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/Create-Qlik-REST-Connection-200x51.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/Create-Qlik-REST-Connection-300x77.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/Create-Qlik-REST-Connection-400x103.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/Create-Qlik-REST-Connection.png 550w" sizes="(max-width: 550px) 100vw, 550px" /></p>
<p>Once that connection is in place you can build the load script.</p>
<p>First you will need to set up some variables for use later in the script. Obviously the webhook parameter will need to be changed to match the webhook that you want to call.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">let vEnv = 'My Qlik Sense Tenant';
let vLib = 'DataSpace:';
let vGET = '$(vLib)Generic GET';
let vQVDs = 'lib://$(vLib)DataFiles/';
let vTimestamps = '$(vQVDs)Timestamp/';
let vWebhook = 'https://maker.ifttt.com/trigger/error/with/key/your-webhook-key-here';

let vLastLoad = now();</code></pre>
<p>Then you need to build the table of files that you want to be checking. These could be QVD files or small files that are written as part of a load script to indicate that the load script has completed. The table requires the full path to each file to be checked, how many hours old the file can get before an alert is raised and what label is to be used in the alert when that file becomes old.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">tmp:
LOAD
    File,Threshold,Name
INLINE [
File,Threshold,Name
$(vQVDs)Sales.qvd,1,Sales Application
$(vTimestamps)QVDGenerateCompleted.csv,3,QVD Generation Application
];</code></pre>
<p>That inline table can then be transformed to convert the hour given in the load script into a time delta to come off the current time, which can then be taken off the current time to work out the time that the file should be newer than. The actual date of the file also needs to be looked up. These two dates can then be compared to find the delta and to flag whether the file is old.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">FileAges:
LOAD
    *,
    if(FileDate &lt; Target, 'Yes', 'No') as Old,
    num((24)*(FileDate - Target), '0.00') as Difference
    ;
LOAD
    File,
    Threshold,
    Name,
    Date(alt(ConvertToLocalTime(FileTime(File), 'London'),0), 'DD MMM YYYY hh:mm') as FileDate,
    Date((LocalTime('London') - ((1/24)*Threshold)), 'DD MMM YYYY hh:mm') as Target
RESIDENT tmp;

DROP TABLE tmp;</code></pre>
<p>This table then needs to be aggregated to find out how many of the files checked are older than they should be. That value needs to be Peeked out into a variable.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">Old:
LOAD sum(1) as Old RESIDENT FileAges WHERE Old = 'Yes';
let vOld = alt(Peek('Old', -1, 'Old'), 0);
DROP TABLE Old;</code></pre>
<p>Now we get to the actual point of the app and the demonstration. If there are any old files, we need to do the call to the webhook endpoint along with a payload that tells us which environment is affected and how many of the files are stale.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">if alt(vOld, 0) &gt; 0 then
    SET errormode = 0;
    LIB CONNECT TO [$(vGET)];
    SQL SELECT "col_1" FROM CSV (header off, delimiter ",", quote """") "CSV_source"
    WITH CONNECTION (URL "$(vWebhook)?value1=$(vEnv)&amp;value2=$(vOld)%20Files%20Are%20Older%20Than%20They%20Should%20Be");
    SET errormode = 1;
end if

TRACE There are $(vOld) files older than expected;</code></pre>
<p>To wrap up, because we are tidy Qlik developers, we clear down the variables that we have used.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">let vEnv =;
let vWebhook =;
let vLib =;
let vGET =;
let vQVDs =;
let vTimestamps =;

Exit Script;</code></pre>
<p>That is it for the load script, and that is all you need to make this work. What you might want to do though, as the list of files checked is in a table in the data model along with their status, is to add a table to a sheet in the app listing the six columns in the <strong>FileAges</strong> table, with some conditional formatting to show when files are old. I would also add a button, which can then refresh the app without going into the load script.</p>
<h3>But What If Even This App Cannot Run?</h3>
<p>If you are running Sense on a Client Managed server it is possible (although very unlikely) that even this application will not be able to run and call the webhook, perhaps if someone has unplugged the server in order to recharge their mobile phone. In this case we need an external service to monitor what is going on. If the server is (as is most likely) behind a firewall that external service will not be able to reach in and check the status. In this case we want a service outside of the network which is expecting to hear from the server at a regular beat which can then raise an alert if it doesn&#8217;t hear anything.</p>
<p>This is exactly what I am going to cover in my next blog post, pulling together elements of this post and the previous post. This solution will use a webhook on a Sense Cloud tenant which calls a reload of a script that writes a to a QVD. There is also a separate application that checks the date of this QVD and notifies if that has not been updated in a specified window. The history of the webhook being called is persisted, so a history of when the calling server was up and able to reach the outside world is recorded, giving an accurate account of uptime on the server.</p>
<p><img decoding="async" class="aligncenter size-fusion-600 wp-image-1505969" src="https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/Sense-Server-Uptime-Matrix-600x116.png" alt="Sense Server Uptime Matrix" width="600" height="116" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/Sense-Server-Uptime-Matrix-200x39.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/Sense-Server-Uptime-Matrix-300x58.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/Sense-Server-Uptime-Matrix-400x77.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/Sense-Server-Uptime-Matrix-600x116.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/Sense-Server-Uptime-Matrix-768x149.png 768w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/11/Sense-Server-Uptime-Matrix.png 780w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<p>If you have any comments on anything you would like to see covered in that blog post, or anything related to this blog post, please use the comments box below to get in touch.</p>
<h3>Other Uses For Calling A Webhook From The Qlik Load Script</h3>
<p>There is literally no end to what you can achieve by calling webhooks, particularly if you use a tool such as <a href="https://ifttt.com/">IFTTT</a>.</p>
<p>Another use you might want to consider, if you are using Qlik Sense Cloud, is <a href="https://www.quickintelligence.co.uk/start-a-qlik-sense-cloud-reload-from-a-webhook/">kicking off a reload using a webhook</a>. In my previous blog post I described how a Qlik Automation can be set up to be triggered from a webhook to do a reload. If at the end of the load script for one app you call the webhook with the correct parameter to kick off the next reload in a chain this reload chain will work however the reload is started, interactively or from a schedule. This gets around the limitation that Qlik Sense Cloud reload chaining from the hub presently has, where the next reload in the chain only takes place if the previous reload was started from a particular schedule. This reload chaining approach also allows for logic to be applied around whether the next reload should take place or not, perhaps the front end should only reload if there has been a change to the backend data?</p>
<p>I hope this post has given you plenty of inspiration of how you can link different services together within, and beyond, your Sense environment.</p>
<p>The post <a href="https://www.quickintelligence.co.uk/starting-external-services-from-qlik-sense-load-scripts/">Starting External Services From Qlik Sense Load Scripts</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.quickintelligence.co.uk/starting-external-services-from-qlik-sense-load-scripts/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1505962</post-id>	</item>
		<item>
		<title>Start a Qlik Sense Cloud Reload from a Webhook</title>
		<link>https://www.quickintelligence.co.uk/start-a-qlik-sense-cloud-reload-from-a-webhook/</link>
					<comments>https://www.quickintelligence.co.uk/start-a-qlik-sense-cloud-reload-from-a-webhook/#respond</comments>
		
		<dc:creator><![CDATA[Steve Dark]]></dc:creator>
		<pubDate>Fri, 31 Oct 2025 18:15:05 +0000</pubDate>
				<category><![CDATA[Qlik Sense Tutorials]]></category>
		<guid isPermaLink="false">https://www.quickintelligence.co.uk/?p=1505920</guid>

					<description><![CDATA[<p>Sometimes the options available in the Sense Cloud scheduler are not sufficient to build the application reload chain that is required. Perhaps loads need to happen in response to external events, or be started by someone that you don’t want to give that level of access to in Cloud. A simple Qlik automation can solve  [...]</p>
<p>The post <a href="https://www.quickintelligence.co.uk/start-a-qlik-sense-cloud-reload-from-a-webhook/">Start a Qlik Sense Cloud Reload from a Webhook</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Sometimes the options available in the Sense Cloud scheduler are not sufficient to build the application reload chain that is required. Perhaps loads need to happen in response to external events, or be started by someone that you don&#8217;t want to give that level of access to in Cloud. A simple Qlik automation can solve this by kicking off the reload from a webhook. This post shows you how.<span id="more-1505920"></span></p>
<p style="text-align: center; padding: 20px 20px; font-size: 16px; background: #edfdd3; border: 1px solid #c4dba0; color: #657e3c;">In June 2026 Qlik are changing how tokens must be sent to Qlik Automations. This means that the token must be passed as a HTTP Header, rather than a URL parameter.<br />
To find out more about this <a href="https://www.quickintelligence.co.uk/qlik-automation-webhooks/" target="_blank">read this blog post</a>.</p>
<h3>What are Webhooks?</h3>
<p>Webhooks are a simple way of getting disparate systems to talk to each other. They allow the triggering of events simply by calling a URL, this could be from a browser bookmark, a link on a page or in code. I&#8217;ve previously blogged on a use of webhooks in the article <a href="https://www.quickintelligence.co.uk/ifttt-webhooks-qlik-cloud/">Using IFTTT and WebHooks To Send Data From Qlik Sense</a>.</p>
<p>In a Sense context the webhooks can be called by creating a Link in the Sense Hub, adding a link to a Button object, a value in a table set to HTML or by calling the webhook from within the load script (using a REST connector to make the call). Triggering from the load script allows the building of reload chains that are not dependant on the Sense scheduler, and for reloads that are data dependant &#8211; for instance calling a reload of another app only when certain data are found in the current app.<br />
<img decoding="async" src="https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Webhook-to-Qlik-400x261.png" alt="" width="400" height="261" class="aligncenter size-fusion-400 wp-image-1505928" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Webhook-to-Qlik-200x131.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Webhook-to-Qlik-300x196.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Webhook-to-Qlik-400x261.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Webhook-to-Qlik-600x392.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Webhook-to-Qlik-768x502.png 768w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Webhook-to-Qlik-800x522.png 800w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Webhook-to-Qlik.png 980w" sizes="(max-width: 400px) 100vw, 400px" /></p>
<h3>What Are Qlik Automations?</h3>
<p>You may have noticed the button <strong>Automations</strong> on the left hand side of the Sense Hub. Under here is a real treasure trove of components that can be used to build complex event driven automations. A lot of the components integrate with your Sense environment, for instance sending Qlik reports to recipients based on loading addresses from an data source. There are also a number of components to integrate with services outside of the Qlik environment, such as Teams, Slack, Hubspot etc. etc.. The automations that you create here don&#8217;t necessarily even need to have a Qlik component involved, for instance you could have an automation that posts to Teams when a new row appears in a Google Sheet. There is a whole host of no-code, drag and drop, opportunities to explore here. For now we are going to create a simple webhook that receives the GUID of an application and reloads it.</p>
<h3>Creating the Automation</h3>
<p>From the left hand menu in the <strong>Sense Hub</strong> select <strong>Automations</strong>, and then click the <strong>Create New Automation </strong>button at the top right. If you don&#8217;t see these options then you don&#8217;t have the permissions to create Automations, and will need to get this granted to you by an administrator via the Sense Console.</p>
<p>You will now see a large number of pre-canned templates for automations (which you can explore later), for now though select <strong>Create Without Template</strong> at the bottom left of the dialog. You will now be prompted to give your new webhook a name and description, and choose where to store it:</p>
<p><img decoding="async" class="aligncenter wp-image-1505921" src="https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Create-New-Automation.png" alt="Name and describe your WebHook" width="475" height="366" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Create-New-Automation-200x154.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Create-New-Automation-300x231.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Create-New-Automation-400x308.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Create-New-Automation-600x462.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Create-New-Automation.png 724w" sizes="(max-width: 475px) 100vw, 475px" /></p>
<p>You will be presented with an almost blank workspace, just with a single <strong>Start</strong> block in the middle. The properties for this block are on the right hand side. Change the <strong>Run Mode</strong> to <strong>Triggered</strong>. You will then see the code, including the execution key you will need to trigger the automation.</p>
<p><img decoding="async" class="aligncenter wp-image-1505923" src="https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Automation-Trigger-Settings.png" alt="Automation Trigger Settings" width="321" height="420" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Automation-Trigger-Settings-200x262.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Automation-Trigger-Settings-229x300.png 229w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Automation-Trigger-Settings-400x523.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Automation-Trigger-Settings.png 425w" sizes="(max-width: 321px) 100vw, 321px" /></p>
<p>Next you need to add an <strong>Input</strong> block, to receive the GUID for the app you wish to reload. On the left hand side search for <strong>Inputs</strong> then drag the inputs component immediately under your <strong>Start</strong> block, you will see a green dot when it is in place and when you drop the new block should be connected by a straight line. Set the <strong>Label</strong> to <strong>app</strong> and the <strong>Input Type</strong> to <strong>Data</strong>.</p>
<p><img decoding="async" class="aligncenter wp-image-1505925" src="https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Automation-Inputs.png" alt="Automation Inputs" width="267" height="358" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Automation-Inputs-200x267.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Automation-Inputs-224x300.png 224w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Automation-Inputs.png 353w" sizes="(max-width: 267px) 100vw, 267px" /></p>
<p>At this point you need to inject a value into the <strong>app</strong> parameter, so that it can be used in the next step. First you will need to save the automation using the <strong>Save</strong> button at the top of the page. Then, from the <strong>POST example </strong>on the <strong>Start </strong>block (pictured above), copy the text from <strong>https://</strong> through to the end of the execution token (in this case <strong>guV1</strong>). Paste this whole string into a new browser tab and make the following edits: add a <strong>?</strong> after the word execute, delete from there up to <strong>X-</strong>, replace the <strong>colon</strong> and <strong>space </strong>with an equals symbol, then add to the end of the URL <strong>&amp;app=x</strong>. So, given the example pictured above the complete URL would be (with the * characters replaced with your details):</p>
<p><strong>https://****.**.qlikcloud.com/api/v1/automations/****-****-****-****/actions/execute?X-Execution-Token=***********&amp;app=x</strong></p>
<p>Click enter to call the URL, and you will simply see <strong>[]</strong> returned in your browser. Leave that browser tab open (you will need it shortly) and return to the Automation editor.</p>
<p>The next bock you require is the one that actually triggers the reload. On the left hand side click on <strong>Qlik Cloud Services</strong> and search for the <strong>Do Reload</strong> component. Drag this under the <strong>Inputs </strong>component. In the properties panel drop down under the <strong>App Id </strong>field and select <strong>Inputs</strong> (this relates to the previous node) then click <strong>History </strong>and select <strong>app: x</strong> from under Inputs (this is what you passed in during the previous step). Set the <strong>Run Mode</strong> to be <strong>Start reload and continue</strong>.</p>
<p><img decoding="async" class="aligncenter wp-image-1505926" src="https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Automation-Do-Reload-Properties.png" alt="Automation Do Reload Properties" width="290" height="255" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Automation-Do-Reload-Properties-200x176.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Automation-Do-Reload-Properties-300x264.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Automation-Do-Reload-Properties-400x352.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2025/10/Automation-Do-Reload-Properties.png 453w" sizes="(max-width: 290px) 100vw, 290px" /></p>
<p>Finally you need to add an <strong>Output</strong> node, so search for this on the left hand panel and then drop it after the <strong>Do Reload</strong> node. In the <strong>Data to output</strong> properties, you should see that it has the <strong>Do Reload</strong> node as the output it will send as a result. If it does not, drop down here and select <strong>Output from Do Reload</strong> and then <strong>Do Reload</strong>.</p>
<p>That is the Automation completed, so click save up the top of the sheet to finish.</p>
<p>Now you will need the GUID of an application that you want to reload. The GUID can be found in the URL when you have an application open, you will find it between <strong>app/ </strong>and <strong>/overview </strong>or <strong>/state</strong>. It will look a bit like this: <strong>0e316df1-fd5c-4cd0-bac1-2f66a03b4c3d</strong>. Copy this to your clipboard and return to the tab where you called the webhook previously. Replace the <strong>x</strong> at the end of the URL with the GUID and return again. This time you should get some JSON returned, confirming that the reload has started. Check the details of the app that you have chosen to reload in the Hub and you should be able to see that a reload has started.</p>
<h3>Calling The Webhook</h3>
<p>As you have seen, you can call your new webhook simply by pasting it into the URL of a browser. It can also be bookmarked, for ease of use. You can create different bookmarks for each of the different apps you want to allow people to reload and most browsers will allow you to export bookmarks to give to someone else to import into their browser. The Sense hub now allows you to add links to the hub, so you can create links in there. Buttons in Sense allow you to call URLs, so that is somewhere else you can call the link.</p>
<p>The resultant webpage is a bit messy, so you might want to have a page that calls the webhook with javascript and parses the output and gives a friendlier results page, or perhaps just triggers a back action to take the user back to where they came from.</p>
<p>To call from a Qlik load script you will need a <a href="https://help.qlik.com/en-US/connectors/Subsystems/REST_connector_help/Content/Connectors_REST/Load-REST-data/Load-data.htm">REST connector</a> created which has the webhook as the URL. If you have a lot of apps you wish to reload in this way you will want to have a placeholder URL in your rest connection and then replace the URL in the script using a <strong>WITH CONNECTION </strong>statement. I describe how to do this in the blog post I referenced at the top of this article: <a href="https://www.quickintelligence.co.uk/ifttt-webhooks-qlik-cloud/">Using IFTTT and WebHooks To Send Data From Qlik Sense</a>.</p>
<p>Hopefully that gives you what you need to be kicking off reloads from various different events and in various different ways. If you have used similar techniques please feel free to share them in the comments below.</p>
<p>&nbsp;</p>
<p>The post <a href="https://www.quickintelligence.co.uk/start-a-qlik-sense-cloud-reload-from-a-webhook/">Start a Qlik Sense Cloud Reload from a Webhook</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.quickintelligence.co.uk/start-a-qlik-sense-cloud-reload-from-a-webhook/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1505920</post-id>	</item>
		<item>
		<title>Generating Test Data In Qlik Load Scripts</title>
		<link>https://www.quickintelligence.co.uk/generating-test-data-in-qlik-load-scripts/</link>
					<comments>https://www.quickintelligence.co.uk/generating-test-data-in-qlik-load-scripts/#respond</comments>
		
		<dc:creator><![CDATA[Steve Dark]]></dc:creator>
		<pubDate>Mon, 20 Nov 2023 10:31:48 +0000</pubDate>
				<category><![CDATA[Back To Basics]]></category>
		<category><![CDATA[Qlik Sense Tutorials]]></category>
		<category><![CDATA[Charting]]></category>
		<category><![CDATA[Correlation]]></category>
		<category><![CDATA[Stats]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">https://www.quickintelligence.co.uk/?p=1505866</guid>

					<description><![CDATA[<p>Sometimes you need to create test data to ensure that a Qlik function behaves the way you expect it should. Recently I had just that requirement to prove that the Correl function gave good results over semi-predictable data. This post shows how you can create data on the fly for these kind of purposes. Data  [...]</p>
<p>The post <a href="https://www.quickintelligence.co.uk/generating-test-data-in-qlik-load-scripts/">Generating Test Data In Qlik Load Scripts</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Sometimes you need to create test data to ensure that a Qlik function behaves the way you expect it should. Recently I had just that requirement to prove that the Correl function gave good results over semi-predictable data. This post shows how you can create data on the fly for these kind of purposes.</p>
<p><span id="more-1505866"></span></p>
<h2>Data Without a Source</h2>
<p>Typically a Qlik application will load its data from a data source, such as a database, API or flat file. Sometimes you just want to create something on the fly. The <strong>AUTOGENERATE</strong> function is a great way of doing this, and many of the applications on my <a href="https://www.quickintelligence.co.uk/examples/" target="_blank" rel="noopener">Qlik Examples</a> page use just this functionality. The function gives a specified number of rows of data that you can then work from. To create a table with a single field with values from 1 to 1,000:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">LOAD
    RowNo() as Value
AUTOGENERATE(1000);</code></pre>
<p>This may be useful in and of itself, but it is more likely you will need to do more. Read on to find out some of the things you can do.</p>
<h2>Well, That&#8217;s A Bit Random</h2>
<p>Often you will want to create some random values, and for this the <strong>rand()</strong> function is what you require. This function will return a number which falls somewhere between 0 and 1. Whilst at first this sounds a bit limited, with some very basic maths you can create many kinds of values.</p>
<p>So, to get a random integer between 0 and 999 you could do the following:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">LOAD
    floor(rand()*1000) as Value
AUTOGENERATE(1000);</code></pre>
<p>If you wanted to get a relatively random number of dimension values from a list you can multiply the random value by the number of values you have, round up to the nearest integer and then use a <strong>pick()</strong> function to choose which dimension value to pick:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">LOAD
    pick(ceil(rand()*5),'Ben','Ian','Tom','Paul','Olly') as Person
AUTOGENERATE(1000);</code></pre>
<p>Note with this approach though you will get roughly the same number of rows for each of the values, due to how random numbers work. If you want to have less regular number of rows you will need to introduce some bias.</p>
<p>If you want to generate random codes that look like they could be real (but are not) you can use the fact that the <strong>chr()</strong> function picks an ascii character based on a number. To get a code that looks like ABC123 you would have:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">LOAD
    chr(65+floor(rand()*26))
        & chr(65+floor(rand()*26))
        & chr(65+floor(rand()*26))
        & num(ceil(rand()*999), '000') as PersonID
AUTOGENERATE(1000);</code></pre>
<p>Given the number of possible values that this could generate you would most likely get all unique values. If you would prefer to guarantee that there are no duplicates you could use <strong>rowno()</strong> instead of <strong>rand()</strong>. If you wanted to cause more duplicates you could reduce the number of characters and the multipliers on each of the random values, perhaps reducing the letters to A to D and the digits to all be multiples of 9:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">LOAD
    chr(65+floor(rand()*4))
        & chr(65+floor(rand()*4))
        & num(ceil(rand()*99)*9, '000') as DupedID
AUTOGENERATE(1000);</code></pre>
<p>If you want to have data shown on a line chart you can generate dates, using the fact that dates are just numbers under the bonnet and we can therefore do maths on them. Again, if you want one row per date then use the <strong>rowno()</strong> function, or if you want more randomness around the rows per day use <strong>rand()</strong>:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">LOAD
    date(today()-(rowno()-1), 'DD MMM YYYY') as Date,
    date(today()-floor(rand()*90), 'DD MMM YYYY') as [Date Rolling 3m]
AUTOGENERATE(1000);</code></pre>
<p>Creating dates in this way has been particularly useful in some of the demo apps I&#8217;ve created, as a simple reload will make the demo look fresh and current as all dates are in a period leading up to the current date.</p>
<p>That&#8217;s just a few examples of generating test data using <strong>AUTOGENERATE</strong>, but I am sure you can think of many more.</p>
<h2>But Does It All Correlate?</h2>
<p>I mentioned at the top that I had a recent requirement to test the <strong>correl()</strong> function, and generated some data to do this. For those who have note come across the statement before, it returns the aggregated correlation coefficient for two data sets. Or put into English, a value is returned which is close to 1 if there is a very strong positive correlation, close to -1 if there is a strong negative correlation and close to zero if there is very little correlation between two sets of values.</p>
<p>The function is called like this:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">correl(aggr(sum(X), Dim), aggr(sum(Y1), Dim))</code></pre>
<p>This is where <strong>Dim</strong> is a dimension value in the data and the two <strong>aggr</strong> statements create two datasets with a row for each dimension value. The <strong>sum(X)</strong> and <strong>sum(Y)</strong> expressions would usually be more complex calculations, but in this case it is simply the numbers generated in the load script.</p>
<p><img decoding="async" src="https://www.quickintelligence.co.uk/wp-content/uploads/2023/11/Correl-X-Y.jpg" alt="Correlation chart X=Y" width="270" height="257" class="alignright size-full wp-image-1505869" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2023/11/Correl-X-Y-200x190.jpg 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2023/11/Correl-X-Y.jpg 270w" sizes="(max-width: 270px) 100vw, 270px" />The load script to make this expression work is as follows:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">LOAD
    'Row ' & num(RowNo(), '#,##0') as Dim,
    RowNo() as X,
    RowNo() as Y1
AUTOGENERATE(1000);</code></pre>
<p>Because we are using the row number for both the <strong>X</strong> and <strong>Y1</strong> values there is an absolute positive correlation and the function returns 1, as it should.</p>
<p><img decoding="async" src="https://www.quickintelligence.co.uk/wp-content/uploads/2023/11/Correl-X-Y-1.jpg" alt="Correlation chart inverse" width="271" height="257" class="alignright size-full wp-image-1505873" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2023/11/Correl-X-Y-1-200x190.jpg 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2023/11/Correl-X-Y-1.jpg 271w" sizes="(max-width: 271px) 100vw, 271px" />For all subsequent tests we keep the Dim dimension and the X value, which always gives us a point along the bottom of the chart. For a negative correlation the value of Y can be calculated as:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">1000 - RowNo() as Y2</code></pre>
<p>So now when X is 0 Y is 1000 and vice versa. This is an absolute negative correlation, and the correl function returns -1, again as it should.</p>
<p>The rest of the values for Y which I tested for where as follows:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">Rand() * 1000 as Y3</code></pre>
<p>A totally random value, which gives a correlation coefficient that is very close to zero and a plot that is full of randomly placed dots.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">RowNo() * Rand() as Y4</code></pre>
<p>A random value between 0 and 1 multiplied by the X value, so that the Y value is random, but never greater than Y. This gives a correlation coefficient that is around 0.5 and a chart where the bottom right half is filled. This could be inverted, but I did not try that value.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">(RowNo() * (Rand()-0.5)) + 500</code></pre>
<p>A value that deviates from the centre of the chart on the Y axis by a random number that is plus or minus half of the value of Y. As the values fall above and below the line equally the correlation is very close to zero.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">RowNo() + ((Rand()-0.5)*(RowNo()/1)) as Y6</code></pre>
<p>This value is similar to the X=Y chart we started with, but with a random deviation from the line in either direction, up to half of the Y value. The divide by 1 is left in there as I was experimenting with having the deviation greater or lesser by dividing the row number. Correlation coefficient is approaching 1, but is not there.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">500 + ((rand()*10)-5) as Y7</code></pre>
<p>This value has a similar Y value for every value of X. I started off having it exactly the same for each X value, but the correl function requires some variance in the number or the spread will be zero causing a divide by zero and no correlation coefficient number. A random deviation of up to 5 in either direction provides this difference, but that deviation is small enough that the correlation coefficient is very close to zero.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">500 + ((rand()*10)-5) as X2</code></pre>
<p>The final expression is a bit different to all the others, as I wanted values from 1 to 1000 for all Y values in order (I use Y1 from above for this) and then have a calculation for the X value that is close to the same value, but off by a small margin. You will note the expression for X2 is identical to Y7, and I could have used the same field in the correl function, but it felt wrong to have two values labeled Y in the chart.</p>
<p>The resultant scatter charts and correlation coefficients for all of the derived values above can be seen in this screenshot (click to expand).</p>
<p><a href="https://www.quickintelligence.co.uk/wp-content/uploads/2023/11/Correl-Function-Screenshot.jpg"><img decoding="async" src="https://www.quickintelligence.co.uk/wp-content/uploads/2023/11/Correl-Function-Screenshot.jpg" alt="Qlik Sense Screen Showing Correl Function" width="1200" height="630" class="aligncenter size-full wp-image-1505875" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2023/11/Correl-Function-Screenshot-200x105.jpg 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2023/11/Correl-Function-Screenshot-300x158.jpg 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2023/11/Correl-Function-Screenshot-400x210.jpg 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2023/11/Correl-Function-Screenshot-600x315.jpg 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2023/11/Correl-Function-Screenshot-768x403.jpg 768w, https://www.quickintelligence.co.uk/wp-content/uploads/2023/11/Correl-Function-Screenshot-800x420.jpg 800w, https://www.quickintelligence.co.uk/wp-content/uploads/2023/11/Correl-Function-Screenshot-1024x538.jpg 1024w, https://www.quickintelligence.co.uk/wp-content/uploads/2023/11/Correl-Function-Screenshot.jpg 1200w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></p>
<p>The entire load script for the Correl application looks like this:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">LOAD
    'Row ' & num(RowNo(), '#,##0') as Dim,
    RowNo() as X,
    RowNo() as Y1,
    1000 - RowNo() as Y2,
    Rand() * 1000 as Y3,
    RowNo() * Rand() as Y4,
    (RowNo() * (Rand()-0.5)) + 500 as Y5,
    RowNo() + ((Rand()-0.5)*(RowNo()/1)) as Y6,
    500 + ((rand()*10)-5) as Y7,
    500 + ((rand()*10)-5) as X2
AUTOGENERATE(1000);</code></pre>
<p>And the entire application can be downloaded from Qlik Community here:<br />
<a href="https://community.qlik.com/t5/Qlik-Sense-Documents/Qlik-Sense-App-Create-Test-Data-For-Correl-Function-Using/ta-p/2139164" rel="noopener" target="_blank">https://community.qlik.com/t5/Qlik-Sense-Documents/Qlik-Sense-App-Create-Test-Data-For-Correl-Function-Using/ta-p/2139164</a></p>
<p>Hopefully that has given you some inspiration what you can do when you need to generate some test data. I would be very interested to hear of other thoughts you might have on the topic, so please do use the comments box below to let me know.</p>
<p>The post <a href="https://www.quickintelligence.co.uk/generating-test-data-in-qlik-load-scripts/">Generating Test Data In Qlik Load Scripts</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.quickintelligence.co.uk/generating-test-data-in-qlik-load-scripts/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1505866</post-id>	</item>
		<item>
		<title>Compare Rolling Twelve Month Period in Qlik</title>
		<link>https://www.quickintelligence.co.uk/compare-rolling-twelve-month-period-in-qlik/</link>
					<comments>https://www.quickintelligence.co.uk/compare-rolling-twelve-month-period-in-qlik/#comments</comments>
		
		<dc:creator><![CDATA[Steve Dark]]></dc:creator>
		<pubDate>Fri, 05 May 2023 11:12:11 +0000</pubDate>
				<category><![CDATA[Load Script]]></category>
		<category><![CDATA[Qlik Sense Tutorials]]></category>
		<category><![CDATA[Dates]]></category>
		<category><![CDATA[Prior Period]]></category>
		<guid isPermaLink="false">https://www.quickintelligence.co.uk/?p=1505817</guid>

					<description><![CDATA[<p>Creating a line chart in Qlik showing a year on year comparison is very easy, using the Month and Year functions to create two dimensions. What if you want to show a rolling twelve month comparison though? This is not quite so obvious, but this post makes it just as easy. The Challenge The question  [...]</p>
<p>The post <a href="https://www.quickintelligence.co.uk/compare-rolling-twelve-month-period-in-qlik/">Compare Rolling Twelve Month Period in Qlik</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Creating a line chart in Qlik showing a year on year comparison is very easy, using the Month and Year functions to create two dimensions. What if you want to show a rolling twelve month comparison though? This is not quite so obvious, but this post makes it just as easy.</p>
<p><span id="more-1505817"></span></p>
<h2>The Challenge</h2>
<p>The question was posed on Qlik Community how to overlay two 12 month measures in one chart. Using set analysis it is straight forward to have two measures which cover the correct date ranges, but when the Month dimension is used it will sort by calendar month, rather in the order required for rolling periods. You can see the question and my response in <a href="https://community.qlik.com/t5/New-to-Qlik-Sense/Overlay-2-rolling-12-month-measures-in-one-chart/m-p/2065557" target="_blank" rel="noopener">this post</a>.</p>
<p>The response uses a technique I have used a number of times before but it occurred to me that I have not documented it on the blog, so here it goes.</p>
<h2>Creating Rolling Month and Year Dimensions</h2>
<p>This code can either sit in your master calendar code, should you use one, or you can place it directly in the load statement from source data. Typically I will go for the latter approach.</p>
<p><img decoding="async" class="alignright size-medium wp-image-1505826" src="https://www.quickintelligence.co.uk/wp-content/uploads/2023/05/Rolling-Twelve-Month-Gauge-300x190.png" alt="Qlik Rolling Twelve Month Compare Gauge" width="300" height="190" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2023/05/Rolling-Twelve-Month-Gauge-200x126.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2023/05/Rolling-Twelve-Month-Gauge-300x190.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2023/05/Rolling-Twelve-Month-Gauge-320x202.png 320w, https://www.quickintelligence.co.uk/wp-content/uploads/2023/05/Rolling-Twelve-Month-Gauge-400x253.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2023/05/Rolling-Twelve-Month-Gauge.png 467w" sizes="(max-width: 300px) 100vw, 300px" />The first thing that we need to do in the load script is to create a sequential integer for each month. This then allows us to work out the number of calendar months between any two dates. This technique has many more uses than just rolling twelve month analysis and is an incredibly useful dimension to have in your data model.</p>
<p>If we do <strong>(Year(Date)*100)+Month(Date) </strong>we will get a sequential integer value within a year (e.g. as at now it will give <strong>202305</strong>), but the deltas break when you go across a year (e.g. comparing <strong>202212</strong> to <strong>202301</strong>). In order to fix this we can just multiply the year by 12 and add the month. So, again taking May 23 as an example you will get <strong>24,281</strong>. This is obviously not at all useful as a human readable number (just as telling someone that the date today is <strong>45051</strong> is only useful if they are a machine), but it means that the numbers for Dec 22 (<strong>24,276</strong>) and Jan 23 (<strong>24,277</strong>) are now just one integer apart.</p>
<p>In the load script we can put this code in to create a new field called <strong>MonthNo</strong> like this:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">(Year(Date) * 12) + Month(Date) as MonthNo,</code></pre>
<p>Now we have that value we need to work out how many months back any given month is from today. The code that we used on the <strong>Date</strong> field can also be done on the <strong>today()</strong> function, giving a comparable figure for the current date. Using a <strong><a href="https://www.quickintelligence.co.uk/preceding-load-qlikview/" target="_blank" rel="noopener">preceding load</a></strong>, we can compare that to the <strong>MonthNo</strong> field to get a value for <strong>Months Back</strong>, like this:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">(Year(today()) * 12) + Month(Today()) - MonthNo as [Months Back]</code></pre>
<p>This new field in itself may be useful in your charts and filters within Sense, for instance it could make your <strong><a href="https://www.quickintelligence.co.uk/prior-period-comparison/" target="_blank" rel="noopener">set analysis</a></strong> for a chart showing the last twelve months much easier as you do not need to deal with date formats in the set code.</p>
<p>Jumping up another level of preceding load we can now use the <strong>Months Back</strong> value to create the <strong>Rolling Month</strong> and <strong>Rolling Year</strong> values.</p>
<p>The <strong>Month</strong> function gives us a dual data-typed value with the three letter month name and the integer order for the month from 1 to 12. The text part of that dual datatype is great for us but the number does not give us what we want.</p>
<p>We can use the <strong>Dual</strong> function though to build our own dual data-typed value with the correct sequential number. Using the output of the Month function as the first parameter of the <strong>Dual</strong> statement will only take the text part of that value. The correct sequential number can be calculated by working out how many months back the start of the year was and then taking away the months back for the date in question.</p>
<p>The whole of that code looks like this:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">Dual(Month(Month), (Floor([Months Back]/12)*12)-[Months Back]) as [Rolling Month],</code></pre>
<p>We can get the number of rolling years back from our <strong>Months Back</strong> value by taking the integer part of the number of months back divided by 12. In order to turn that into text to show as a dimension we want to suffix it with the text &#8220;Years Back&#8221;. As having &#8220;0 Years Back&#8221; looks a bit naff, we need to have anything in the past 12 months showing as &#8220;Current Year&#8221;. Having that text means that sorting on the field breaks (as it would if you have more than a decade of data), so we need to use the <strong>dual</strong> function again.</p>
<p>Putting all of that together gives us this statement:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">Dual(if([Months Back] &lt; 12, 'Current Year',
    Floor([Months Back]/12) &amp; ' Years Back'),
    Floor([Months Back]/12)) as [Rolling Year]</code></pre>
<p>We then have the two dimensions that we can use in a line chart:</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505822" src="https://www.quickintelligence.co.uk/wp-content/uploads/2023/05/Rolling-Twelve-Month-Line-Chart.png" alt="Line chart showing rolling twelve months" width="926" height="336" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2023/05/Rolling-Twelve-Month-Line-Chart-200x73.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2023/05/Rolling-Twelve-Month-Line-Chart-300x109.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2023/05/Rolling-Twelve-Month-Line-Chart-400x145.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2023/05/Rolling-Twelve-Month-Line-Chart-600x218.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2023/05/Rolling-Twelve-Month-Line-Chart-768x279.png 768w, https://www.quickintelligence.co.uk/wp-content/uploads/2023/05/Rolling-Twelve-Month-Line-Chart-800x290.png 800w, https://www.quickintelligence.co.uk/wp-content/uploads/2023/05/Rolling-Twelve-Month-Line-Chart.png 926w" sizes="(max-width: 926px) 100vw, 926px" /></p>
<h2>Putting It All Together</h2>
<p>This code generates a whole bunch of dates and then applies the date code described above in a resident load. You can copy and paste this to a new app and see the code working in isolation, or your can take parts of it to apply to your own data.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">tmpDate:
LOAD
    Date(today()-RowNo(), 'DD MMM YYYY') as Date
AUTOGENERATE(2000);

Dates:
LOAD
    *,
    Dual(Month(Month),
        (Floor([Months Back]/12)*12)-[Months Back]) as [Rolling Month],
    Dual(if([Months Back] &lt; 12, 'Current Year',
        Floor([Months Back]/12) &amp; ' Years Back'),
        Floor([Months Back]/12)) as [Rolling Year]
    ;
LOAD
    *,
    (Year(today()) * 12) + Month(Today()) - MonthNo as [Months Back]
    ;
LOAD
    Rand() * 1000 as Value,
    Date,
    Date(MonthStart(Date), 'MMM YYYY') as Month,
    (Year(Date) * 12) + Month(Date) as MonthNo,
    Month(Date) as [Month Name]
RESIDENT tmpDate
;

DROP TABLE tmpDate;</code></pre>
<p>Something else you might want to deal with when looking at rolling months is a <strong><a href="https://www.quickintelligence.co.uk/qlik-run-rate/" rel="noopener" target="_blank">run rate</a></strong> value for the current month, which takes into account how far through the month we are and what the value will be if extrapolated to the number of days in the month. I have covered this in a <a href="https://www.quickintelligence.co.uk/qlik-run-rate/" rel="noopener" target="_blank">previous post</a>.</p>
<p>Not only does this code give you dimensions that you can use in your charts, the same dimensions can be used in set analysis also. To create the variance to prior rolling twelve months gauge at the top of the chart you can now just use this code:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeexp">(Sum({&lt;[Rolling Year]*={'1 Years Back'}&gt;}Value) /
Sum({&lt;[Rolling Year]*={'Current Year'}&gt;}Value)) -1</code></pre>
<p>An example QVF file including this code and some example charts can be downloaded from the <a href="https://community.qlik.com/t5/New-to-Qlik-Sense/Overlay-2-rolling-12-month-measures-in-one-chart/m-p/2065557" target="_blank" rel="noopener">Qlik Community</a> post.</p>
<p>I would be very interested to hear from you on this technique and whether you have used similar or can suggest other ways it could be used. Please use the comments below if you would like to add your thoughts.</p>
<p>The post <a href="https://www.quickintelligence.co.uk/compare-rolling-twelve-month-period-in-qlik/">Compare Rolling Twelve Month Period in Qlik</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.quickintelligence.co.uk/compare-rolling-twelve-month-period-in-qlik/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1505817</post-id>	</item>
		<item>
		<title>Google SMTP and IMAP to break in Qlik Apps Next Month</title>
		<link>https://www.quickintelligence.co.uk/google-smtp-and-imap-to-break-gmail/</link>
					<comments>https://www.quickintelligence.co.uk/google-smtp-and-imap-to-break-gmail/#comments</comments>
		
		<dc:creator><![CDATA[Steve Dark]]></dc:creator>
		<pubDate>Mon, 25 Apr 2022 08:45:18 +0000</pubDate>
				<category><![CDATA[Qlik Sense Tutorials]]></category>
		<category><![CDATA[QlikView Tutorial]]></category>
		<category><![CDATA[GMail]]></category>
		<category><![CDATA[IMAP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Settings]]></category>
		<category><![CDATA[SMTP]]></category>
		<guid isPermaLink="false">https://www.quickintelligence.co.uk/?p=1505460</guid>

					<description><![CDATA[<p>Many posts and articles, including on this blog, have recommended the use of GMail for sending and receiving mails with Qlik. More recently this has required a switch on the Google Account to Allow Less Secure Apps. Support for this is ending on the 31st May, here’s what you need to know. Why Use GMail  [...]</p>
<p>The post <a href="https://www.quickintelligence.co.uk/google-smtp-and-imap-to-break-gmail/">Google SMTP and IMAP to break in Qlik Apps Next Month</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Many posts and articles, including on <a href="https://www.quickintelligence.co.uk/sense-capacity-licence-notify/" target="_blank" rel="noopener">this blog</a>, have recommended the use of GMail for sending and receiving mails with Qlik. More recently this has required a switch on the Google Account to <a href="https://support.google.com/accounts/answer/6010255" target="_blank" rel="noopener">Allow Less Secure Apps</a>. Support for this is ending on the 31st May, here&#8217;s what you need to know.<br />
<span id="more-1505460"></span></p>
<h3>Why Use GMail For Sending and Receiving From Qlik?</h3>
<p><img decoding="async" class="alignright size-medium wp-image-1505461" src="https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/GMailInbox-300x191.png" alt="GMail Inbox" width="300" height="191" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/GMailInbox-200x127.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/GMailInbox-300x191.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/GMailInbox-400x254.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/GMailInbox-460x295.png 460w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/GMailInbox-600x382.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/GMailInbox-768x488.png 768w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/GMailInbox-800x509.png 800w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/GMailInbox.png 805w" sizes="(max-width: 300px) 100vw, 300px" />There are a wide number of features within the Qlik ecosystem that require interaction with email. QlikView Enterprise allows sending of alerts on task failures, NPrinting is all about distributing reports and Qlik Sense SaaS has multiple features for sending mails, from task failure notifications to subscriptions to charts or sheets. Beyond the obvious use cases there are many more reasons why you may interact with a mail server, such as <a href="https://www.quickintelligence.co.uk/send-data-from-qlik-load-script/" target="_blank" rel="noopener">Sending Notifications From The Load Script</a> or even using a mail server as a data source, such as in this <a href="https://www.quickintelligence.co.uk/netgear-router-logs-qlik-sense/" target="_blank" rel="noopener">example of loading router logs</a>.</p>
<p>Many companies use <a href="https://workspace.google.com/" target="_blank" rel="noopener">Google Workspace</a> for their internal systems, so using a Workspace account for sending and receiving mail makes sense, and for individuals learning Sense spinning up a <a href="https://www.google.com/intl/en-GB/gmail/about/" target="_blank" rel="noopener">GMail</a> account for this purpose is a no cost way of achieving the same result.</p>
<h3>Why Allow Access For Less Secure Apps?</h3>
<p>Google, and general security best practice, recommend using 2FA for authentication. Google Accounts implement this via Google Prompts (on a signed in phone), text message, the <a href="https://support.google.com/accounts/answer/1066447" target="_blank" rel="noopener">Google Authenticator</a> app or a physical device. Having a third party application (or, ironically, Google&#8217;s own email migrate tools) connect to your account via SMTP, IMAP or POP3 is deemed less secure as it inherently uses a username as password only to connect.</p>
<p>The solution for this, for the past couple of years, has been to set a switch on the Google Account that is being used in this way to say that you are comfortable with username and password access to the account in this way. Recently though, a new message has appeared on the dialog where this switch is set:</p>
<p><img decoding="async" class="alignright size-full wp-image-1505463" src="https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Less-Secure-Apps-Dialog.png" alt="Less Secure App Switch Dialog" width="849" height="246" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Less-Secure-Apps-Dialog-200x58.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Less-Secure-Apps-Dialog-300x87.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Less-Secure-Apps-Dialog-400x116.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Less-Secure-Apps-Dialog-600x174.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Less-Secure-Apps-Dialog-768x223.png 768w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Less-Secure-Apps-Dialog-800x232.png 800w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Less-Secure-Apps-Dialog.png 849w" sizes="(max-width: 849px) 100vw, 849px" /></p>
<p>It advises that this access will be revoked from the 30th of May, and the <a href="https://support.google.com/accounts/answer/6010255" target="_blank" rel="noopener">Find Out More</a> link gives a bit more background, but not quite enough. The long and the short is though, that if you are using GMail servers after this date, without an App Password, they will no longer function correctly.</p>
<h3>So, How Do I Fix This?</h3>
<p>At the bottom of that article there is a link to information on <a href="https://support.google.com/accounts/answer/185833" target="_blank" rel="noopener">Signing In With App Passwords</a>, this is a much more helpful document. The steps to resolve the issue are outlined here though.</p>
<p><strong>Head to Account Settings and Security for the account you wish to use</strong></p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505467" src="https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Google-Security-Menu.png" alt="Google Security Menu" width="350" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Google-Security-Menu-200x106.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Google-Security-Menu-300x159.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Google-Security-Menu-400x212.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Google-Security-Menu.png 497w" sizes="(max-width: 497px) 100vw, 497px" /></p>
<p><strong>Turn on 2FA for the account you wish to use</strong></p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505466" src="https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Google-Prompts.png" alt="Google Prompt Methods" width="510" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Google-Prompts-200x38.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Google-Prompts-300x57.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Google-Prompts-400x76.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Google-Prompts-600x114.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Google-Prompts-669x128.png 669w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Google-Prompts.png 672w" sizes="(max-width: 672px) 100vw, 672px" /></p>
<p><strong>Select to create an App Password for this account</strong></p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505470" src="https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/App-Passwords-Menu.png" alt="App Passwords Menu" width="510" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/App-Passwords-Menu-200x17.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/App-Passwords-Menu-300x25.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/App-Passwords-Menu-400x33.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/App-Passwords-Menu-600x50.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/App-Passwords-Menu-768x64.png 768w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/App-Passwords-Menu-800x67.png 800w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/App-Passwords-Menu.png 848w" sizes="(max-width: 848px) 100vw, 848px" /></p>
<p><strong>Select Other from the app list and enter Qlik Sense or similar</strong></p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505468" src="https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Create-Google-App-Password.png" alt="Create Google App Password" width="510" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Create-Google-App-Password-200x129.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Create-Google-App-Password-300x194.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Create-Google-App-Password-400x259.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Create-Google-App-Password-600x388.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Create-Google-App-Password.png 683w" sizes="(max-width: 683px) 100vw, 683px" /></p>
<p><strong>Copy the generated password to your clipboard</strong></p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505469" src="https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Copy-Google-App-Password.png" alt="Copy Google App Password" width="460" height="335" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Copy-Google-App-Password-200x146.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Copy-Google-App-Password-300x218.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Copy-Google-App-Password-400x291.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Copy-Google-App-Password.png 460w" sizes="(max-width: 460px) 100vw, 460px" /></p>
<p><strong>Use the App Password as you would your normal password</strong></p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505471" src="https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Qlik-Sense-SMTP-Settings.png" alt="Qlik Sense SMTP Settings" width="633" height="285" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Qlik-Sense-SMTP-Settings-200x90.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Qlik-Sense-SMTP-Settings-300x135.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Qlik-Sense-SMTP-Settings-400x180.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Qlik-Sense-SMTP-Settings-600x270.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/04/Qlik-Sense-SMTP-Settings.png 633w" sizes="(max-width: 633px) 100vw, 633px" /></p>
<p>You can come back into the App Password settings to manage old passwords and remove them when you no longer use them. Note that when you change the password on the account any App Passwords will be removed, so you will need to recreate these and plumb them back in when this happens. Note that you can not recover an old App Password, so make sure you enter it everywhere you need to before you lose it from your clipboard (or put it in your password safe).</p>
<p>Once all of this has been done your Qlik apps and servers can interact with your Workspace or GMail account without issue, and they will continue to do so after the date which Google removes support for less secure apps.</p>
<p>I hope this post helps you avoid any nasty surprises next month.</p>
<p>The post <a href="https://www.quickintelligence.co.uk/google-smtp-and-imap-to-break-gmail/">Google SMTP and IMAP to break in Qlik Apps Next Month</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.quickintelligence.co.uk/google-smtp-and-imap-to-break-gmail/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1505460</post-id>	</item>
		<item>
		<title>Back Up Qlik Sense Enterprise Client Managed Applications</title>
		<link>https://www.quickintelligence.co.uk/back-up-qlik-sense-applications/</link>
					<comments>https://www.quickintelligence.co.uk/back-up-qlik-sense-applications/#comments</comments>
		
		<dc:creator><![CDATA[Steve Dark]]></dc:creator>
		<pubDate>Mon, 21 Mar 2022 10:17:24 +0000</pubDate>
				<category><![CDATA[Instant App]]></category>
		<category><![CDATA[Qlik Sense Tutorials]]></category>
		<category><![CDATA[Admin]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Instant Sense App]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[Sense]]></category>
		<guid isPermaLink="false">https://www.quickintelligence.co.uk/?p=1505431</guid>

					<description><![CDATA[<p>It is common to back up Qlik Sense Client Managed servers at a server level, often with a virtual machine snapshot. Applications can be backed up by having copies of them in different streams or work areas on the server. Apps can be exported one application at a time using the Export function, which is  [...]</p>
<p>The post <a href="https://www.quickintelligence.co.uk/back-up-qlik-sense-applications/">Back Up Qlik Sense Enterprise Client Managed Applications</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>It is common to back up Qlik Sense Client Managed servers at a server level, often with a virtual machine snapshot. Applications can be backed up by having copies of them in different streams or work areas on the server. Apps can be exported one application at a time using the Export function, which is time consuming. Or a file level backup can be made by copying the repository, but apps are hard to identify as they all have a GUID for the name. This post looks at a simple way that all apps can be copied to a different location, as a QVF file, with a sensible file name.<br />
<span id="more-1505431"></span></p>
<h3>API Connections in Qlik Sense Client Managed</h3>
<p><img decoding="async" class="alignright size-medium wp-image-1505453" src="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Back-Up-All-Qlik-Sense-Applications-300x199.png" alt="Back Up All Qlik Sense Applications" width="300" height="199" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Back-Up-All-Qlik-Sense-Applications-200x132.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Back-Up-All-Qlik-Sense-Applications-300x199.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Back-Up-All-Qlik-Sense-Applications-400x265.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Back-Up-All-Qlik-Sense-Applications-600x397.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Back-Up-All-Qlik-Sense-Applications-768x509.png 768w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Back-Up-All-Qlik-Sense-Applications.png 773w" sizes="(max-width: 300px) 100vw, 300px" />Straight of the box with a clean install Sense has a number of REST Connections created for you to explore your environment. It&#8217;s well worth exploring what these connections offer, with regards to looking at users and usage.</p>
<p>For this post though we are going to be looking at the <strong>monitor_apps_REST_app</strong> connection.</p>
<p>Create a new app and go to the <strong>Data Load Editor</strong>. If you can see the <strong>monitor_apps_REST_app</strong> connection we are good to go. If it&#8217;s not there you will need to grant yourself rights in the <strong>QMC</strong> under the <strong>Data Connections</strong> settings, find the correct connector and select <strong>Security Rules</strong>.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505432" src="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Qlik-Connector-Settings.png" alt="Qlik Connector Settings" width="531" height="145" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Qlik-Connector-Settings-200x55.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Qlik-Connector-Settings-300x82.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Qlik-Connector-Settings-400x109.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Qlik-Connector-Settings.png 531w" sizes="(max-width: 531px) 100vw, 531px" /></p>
<p>From here you can grant yourself access to the one connection by your name or user id:</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505433" src="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/User-Permissions-Connection.png" alt="User Permissions Connection" width="603" height="166" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/User-Permissions-Connection-200x55.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/User-Permissions-Connection-300x83.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/User-Permissions-Connection-400x110.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/User-Permissions-Connection-600x165.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/User-Permissions-Connection.png 603w" sizes="(max-width: 603px) 100vw, 603px" /></p>
<p>Or alternatively, if you are a <strong>RootAdmin</strong> on the <strong>QMC</strong> you may want to grant the <strong>RootAdmin</strong> role access to all connections on the server. This will mean that administrators can all explore all of the default connections and keep an eye on what users are creating also. Do this by replacing the GUID of the connection in the <strong>Resource Filter</strong> with an asterisk. Obviously, you can tailor the permissions to be whatever you need.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505434" src="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/RootAdmin-Permissions-Connection.png" alt="RootAdmin Permissions Connection" width="608" height="187" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/RootAdmin-Permissions-Connection-200x62.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/RootAdmin-Permissions-Connection-300x92.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/RootAdmin-Permissions-Connection-400x123.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/RootAdmin-Permissions-Connection-600x185.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/RootAdmin-Permissions-Connection.png 608w" sizes="(max-width: 608px) 100vw, 608px" /></p>
<p>When you go back to the <strong>Data Load Editor</strong> in another tab the connections will not have appeared automatically. You will have to refresh the browser with a <strong>Shift-F5</strong>, or click the refresh button in the browser toolbar.</p>
<h3>Loading Data From REST API Connection</h3>
<p>Now you have access to the correct REST connection, you can use the <strong>Select Data</strong> icon next to the <strong>monitor_apps_REST_app</strong> connection to look at the data. Alternatively, you can use the script here to pull the information that you need.</p>
<p>Before we connect to the data though, we are going to set up some variables which describe where the apps currently reside and where we want to back them up to. The apps will be in your <strong>repository</strong>, the location of which will have been set when Sense was installed. There will be a share, most likely on the Sense server, pointing to this location. In here find the Apps folder, which contains a file for each app, with a GUID for a name and no extension. The destination is simply where you want to copy to. Here I create a dated folder for the backup:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Set up locations of Sense Repository and a backup location
// Used in the backup script field
let vSrcFolder = 'c:\QlikSenseRepository\Apps\';
let vDestFolder = 'c:\SenseBackups\AppBackup' &amp; date(today(), 'YYYYMMDD') &amp; '\';</code></pre>
<p>A connection then needs to be made to the REST API in order to load data from it:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Connect to the REST connection
LIB CONNECT TO 'monitor_apps_REST_app';</code></pre>
<p>With this in place we can then pull the data from the REST connection, using this code:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Load raw JSON Data
RawRESTData:
SQL SELECT
"id" AS "id_u1",
"createdDate",
"modifiedDate",
"modifiedByUserName",
"name" AS "name_u1",
"publishTime",
"published",
"description",
"fileSize",
"lastReloadTime",
"thumbnail",
"savedInProductVersion",
"availabilityStatus",
"schemaPath",
"__KEY_root",
(SELECT
"userId",
"userDirectory",
"name",
"__FK_owner"
FROM "owner" FK "__FK_owner"),
(SELECT
"name" AS "name_u0",
"__FK_stream"
FROM "stream" FK "__FK_stream")
FROM JSON (wrap on) "root" PK "__KEY_root";</code></pre>
<p>As with loading data from just about any REST connection, the data will come down in a single table, even though there are three logical tables in the data model. Each row of data will have values in columns in one of the three sets (Application Details, User Details and Stream), values in the other columns will be null. Along with these values are primary and foreign keys to join things correctly.</p>
<p>Using <strong>Select Data</strong> the Qlik engine will create some code which will load three separate tables into the end data model. In this case however we know there is a one-to-one relationship between an Application and its Owner and the Stream it is in (if the application is published). We can therefore create a cleaner and flatter data model with <a href="https://www.quickintelligence.co.uk/applymap-is-it-so-wrong/">ApplyMap</a>.</p>
<p>There is much more we can do also, to make it easier to select the apps we want to back up, and do further analysis on apps. The same data feed can be used to help use identify apps which are not being maintained or are bloated.</p>
<h3>Cleaning Up The Application Table</h3>
<p>Now we have all of the data in a temporary table we need to clean it up and augment it. This will be done with a number of <a href="https://help.qlik.com/en-US/sense/February2022/Subsystems/Hub/Content/Sense_Hub/Scripting/load-data-from-previously-loaded-table.htm" target="_blank" rel="noopener">RESIDENT</a> loads and a couple of <a href="https://www.quickintelligence.co.uk/preceding-load-qlikview/">Preceding Loads</a>.</p>
<p>First we are going to create some ApplyMap statements to bring in the Owner name, Owner login and Stream. These use the foreign keys in the flat table.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Create mapping tables from parts of the REST result
Map_Owner:
MAPPING LOAD
[__FK_owner],
[name]
RESIDENT RawRESTData
WHERE NOT IsNull([__FK_owner]);

Map_OwnerLogin:
MAPPING LOAD
[__FK_owner],
[userDirectory] &amp; '\' &amp; [userId] as Login
RESIDENT RawRESTData
WHERE NOT IsNull([__FK_owner]);

Map_Stream:
MAPPING LOAD
[__FK_stream],
[name_u0]
RESIDENT RawRESTData
WHERE NOT IsNull([__FK_stream]);</code></pre>
<p>Then some variables which act as functions in the subsequent RESIDENT load. These all utilise the fact that a SET statement does not evaluate the code that it puts into a variable (rather it copies code verbatim) and the functionality of <a href="https://www.quickintelligence.co.uk/variables-parameters-load-script/">passing parameters into variables</a>.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Create parameterised variables for repeated tasks
set vTime = Date(if(Date#(left($1, 10), 'YYYY-MM-DD') &lt; 0, null(),
Date#(left(replace($1, 'T', ' '), 19), 'YYYY-MM-DD hh:mm:ss')),
'DD MMM YYYY hh:mm:ss') as [$2 Date Time];
set vDP = Date(DayStart([$1 Date Time]), 'DD MMM YYYY') as [$1 Date],
Date(MonthStart([$1 Date Time]), 'MMM-YYYY') as [$1 Month],
Month([$1 Date Time]) as [$1 Month Name],
Year([$1 Date Time]) as [$1 Year],
WeekDay([$1 Date Time]) as [$1 Day],
today() - DayStart([$1 Date Time]) as [Days Since $1];
set vNS = if($1 = '', 'Not Specified', $1);</code></pre>
<p>The first function here receives the name of a date field and checks whether it has a value, if it does it returns that converted to a date and formatted correctly. The second takes the date time field created by the previous variable (thanks to a preceding load) and creates various date parts for these dates. The final variable checks a given field name and returns <strong>Not Specified</strong> if the value is empty, otherwise it returns the value.</p>
<p>You will see all of these variables used in the next block of code.</p>
<p>We can then do our final RESIDENT load to bring through all of the original data, with the various transformations applied.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">Applications:
LOAD
1 as ApplicationCount,
*,
RangeMin([Days Since Created],
[Days Since Modified],
[Days Since Published],
[Days Since Last Reload]) as [Days Since Last Touch],
// Export this column to create a script to backup your apps from the Repository
'copy $(vSrcFolder)' &amp; GUID &amp;
' "$(vDestFolder)' &amp; Stream &amp; ' -- ' &amp;
Application &amp; '.qvf"' as [App Backup Script]
;
LOAD
*,
// Create all required date parts
$(vDP(Created)),
$(vDP(Modified)),
$(vDP(Published)),
$(vDP(Last Reload))
;
LOAD
id_u1 as GUID,
// Convert all required dates
$(vTime(createdDate, Created)),
$(vTime(modifiedDate, Modified)),
$(vTime(lastReloadTime, Last Reload)),
$(vTime(publishTime, Published)),
[modifiedByUserName] as [Modified By],
[name_u1] as Application,
[published] as [Is Published],
$(vNS(description)) as [Application Description],
fileSize / 1000000 as [File Size],
$(vNS(thumbnail)) as Thumbnail,
[savedInProductVersion] as [Product Version],
[availabilityStatus] as Availability,
ApplyMap('Map_Owner', [__KEY_root], 'Not Known') as Owner,
ApplyMap('Map_OwnerLogin', [__KEY_root], 'Not Known') as [Owner Login],
ApplyMap('Map_Stream', [__KEY_root], 'None') as Stream
RESIDENT RawRESTData
WHERE NOT IsNull([__KEY_root]);</code></pre>
<p>Then, to tidy things up and avoid any strange joins, we can remove the temporary table which was created when the data was pulled from the REST connection.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">DROP TABLE RawRESTData;</code></pre>
<p>And that is our load script done.</p>
<h3>Unpacking The Application Back Up Code</h3>
<p>There is quite a lot going on in that last step of the code. Hopefully you can work out what is going on with most, if not all, of it. Much of it is to give us some extra fields to do some analysis of the applications on our server (more on that later), but for now just to focus on the creation of the <strong>App Backup Script</strong> field.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">'copy $(vSrcFolder)' &amp; GUID &amp; ' "$(vDestFolder)' &amp;
Stream &amp; ' -- ' &amp; Application &amp; '.qvf"' as [App Backup Script]</code></pre>
<p>Here we are starting with the copy statement we wish to use (you can replace this with XCopy or add parameters if you wish), adding in the two variables we set up right at the top of the script and pilling out the GUID which is the source filename for our script. There is then the building of the output filename and the placing this in a fieldname.</p>
<p>The construction of the output filename and path you can also alter if you wish, I have gone for the stream name (which is set to None for items that are not published) a double hyphen (as apps and streams may have hyphens in the name already) the application name and finally the QVF extension.</p>
<p>This then builds code that we can use in a <strong>Command Prompt</strong> on our Qlik Sense server to move the apps to their backup location.</p>
<h3>Creating and Using The Back Up Script</h3>
<p>Now our script is complete, click <strong>Load Data</strong> to bring all the data in from the REST connection. Once this has finished loading click <strong>Analyse Sheet</strong> and change to <strong>Edit</strong> mode. Grab a <strong>Table</strong> object from the <strong>Charts</strong> and drop it on the sheet. Click to <strong>Add Dimension</strong> and add in the <strong>App Backup Script</strong> dimension.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505441" src="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Add-App-Backup-Dimension.png" alt="Add App Backup Dimension" width="420" height="149" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Add-App-Backup-Dimension-200x71.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Add-App-Backup-Dimension-300x106.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Add-App-Backup-Dimension-400x142.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Add-App-Backup-Dimension.png 420w" sizes="(max-width: 420px) 100vw, 420px" /></p>
<p>Come out of Edit mode and you can then right click to export the table to Excel. Open this spreadsheet and copy and paste the code into a new <strong>Notepad</strong> (or other text editor) window and then save the script as a <strong>.bat</strong> file. This file can then be copied onto the server and executed to perform the backup.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505450" src="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Back-Up-Script-Running.png" alt="Back Up Script Running" width="872" height="231" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Back-Up-Script-Running-200x53.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Back-Up-Script-Running-300x79.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Back-Up-Script-Running-400x106.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Back-Up-Script-Running-600x159.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Back-Up-Script-Running-768x203.png 768w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Back-Up-Script-Running-800x212.png 800w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Back-Up-Script-Running.png 872w" sizes="(max-width: 872px) 100vw, 872px" /></p>
<p>There is a slight risk of one of the files being corrupted if it is copied whilst a write is in progress, so it is best practice to stop all Sense services before taking the backup. In practice, I have not ever hit a snag with this though and you could simply check the date stamp on the files and see if there were any that were updated at around the time you took your backup and perhaps copy them again.</p>
<p>So there you have a relatively quick and painless way of getting QVFs of all of your Qlik Sense Client Managed Server applications.</p>
<p>I hope you find the technique useful. Please let us know how you get on in the comments below.</p>
<h3>Further Analysis of Your Application Data</h3>
<p>As well as the the information required to filter and export the backup script there were various other data points brought in about the Applications on the Sense Server which you may want to analyse. Finding which applications have not been touched in over a year, for example.</p>
<p>Fortunately we have your back with this, with our <a href="https://www.quickintelligence.co.uk/instant-qlik-sense-app/" target="_blank" rel="noopener">Instant Sense Application</a>. This is an application template which ships with a number of pre-written load scripts (including the one above) and metadata files so that you can re-purpose the application to use your own data sources. Out of the box you can view a number of KPIs over these application data:</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505443" src="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-KPIs.png" alt="Some Application KPIs" width="905" height="246" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-KPIs-200x54.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-KPIs-300x82.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-KPIs-400x109.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-KPIs-600x163.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-KPIs-768x209.png 768w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-KPIs-800x217.png 800w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-KPIs.png 905w" sizes="(max-width: 905px) 100vw, 905px" /></p>
<p>It also allows you to break the various measures down over different dimensions and plot those different measures against each other, by a selected dimension:</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505444" src="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-Scatter-Chart.png" alt="Application Scatter Chart" width="611" height="345" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-Scatter-Chart-200x113.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-Scatter-Chart-300x169.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-Scatter-Chart-400x226.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-Scatter-Chart-600x339.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-Scatter-Chart.png 611w" sizes="(max-width: 611px) 100vw, 611px" /></p>
<p>Finally there is the user defined table, where the user can select a number of dimensions and measures and view these in a table which can then be exported as required:</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505446" src="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-Measure-Table.png" alt="Application Measure Table" width="929" height="356" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-Measure-Table-200x77.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-Measure-Table-300x115.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-Measure-Table-400x153.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-Measure-Table-600x230.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-Measure-Table-768x294.png 768w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-Measure-Table-800x307.png 800w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Application-Measure-Table.png 929w" sizes="(max-width: 929px) 100vw, 929px" /></p>
<p>Everything in the application is driven from a metadata spreadsheet, this means that you can configure the app so it can be used over whatever data source you like:</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505448" src="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Instant-Application-Metadata.png" alt="Instant Application Metadata" width="697" height="142" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Instant-Application-Metadata-200x41.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Instant-Application-Metadata-300x61.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Instant-Application-Metadata-400x81.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Instant-Application-Metadata-600x122.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2022/03/Instant-Application-Metadata.png 697w" sizes="(max-width: 697px) 100vw, 697px" /></p>
<p>All in all there are twelve sheets of user configurable visualisations, just waiting for you to bring your own data. The best thing is that it is free to download and use.</p>
<p>Find out more about the application, and download it, from here:</p>
<p><strong><a href="https://www.quickintelligence.co.uk/instant-qlik-sense-app/" target="_blank" rel="noopener">https://www.quickintelligence.co.uk/instant-qlik-sense-app/</a></strong></p>
<p>More technical details, including how the application is built can be found in this <a href="https://www.quickintelligence.co.uk/instant-qlik-sense-application/" target="_blank" rel="noopener">Instant Sense Application blog post</a>.</p>
<p>If you have any questions or comments about anything above, please do drop us a comment below.</p>
<p>If you would like to share a load script and metadata spreadsheet for the Instant Sense Application then we would love to hear from you.</p>
<p>The post <a href="https://www.quickintelligence.co.uk/back-up-qlik-sense-applications/">Back Up Qlik Sense Enterprise Client Managed Applications</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.quickintelligence.co.uk/back-up-qlik-sense-applications/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1505431</post-id>	</item>
		<item>
		<title>Use IFTTT and Webhooks to Send Data from Qlik Sense</title>
		<link>https://www.quickintelligence.co.uk/ifttt-webhooks-qlik-cloud/</link>
					<comments>https://www.quickintelligence.co.uk/ifttt-webhooks-qlik-cloud/#respond</comments>
		
		<dc:creator><![CDATA[Steve Dark]]></dc:creator>
		<pubDate>Wed, 12 May 2021 09:05:54 +0000</pubDate>
				<category><![CDATA[Qlik Sense]]></category>
		<category><![CDATA[Qlik Sense Tutorials]]></category>
		<category><![CDATA[IFTTT]]></category>
		<category><![CDATA[Sense]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Webhooks]]></category>
		<guid isPermaLink="false">https://www.quickintelligence.co.uk/?p=1505353</guid>

					<description><![CDATA[<p>Webhooks are a glue that can hold many different services together. This post shows how they can be used to call IFTTT from the Qlik load script, which then opens up a whole world of possibilities, such as writing to a Google Sheet. So, Why Use IFTTT With Qlik Sense? In my previous blog post  [...]</p>
<p>The post <a href="https://www.quickintelligence.co.uk/ifttt-webhooks-qlik-cloud/">Use IFTTT and Webhooks to Send Data from Qlik Sense</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Webhooks are a glue that can hold many different services together. This post shows how they can be used to call IFTTT from the Qlik load script, which then opens up a whole world of possibilities, such as writing to a Google Sheet.<br />
<span id="more-1505353"></span></p>
<h3>So, Why Use IFTTT With Qlik Sense?</h3>
<p>In my previous blog post I showed how to create an app to monitor <a href="https://www.quickintelligence.co.uk/sense-capacity-licence-notify/" target="_blank" rel="noopener">Qlik analyzer capacity licence usage</a> in Qlik Cloud. My favourite response to the last post was from Tom Wittig, who said he had five clients needing the app.</p>
<p><a href="https://www.linkedin.com/feed/update/urn:li:activity:6795976356673982464?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A6795976356673982464%2C6796039225348300800%29&amp;replyUrn=urn%3Ali%3Acomment%3A%28activity%3A6795976356673982464%2C6796060876433616896%29" target="_blank" rel="noopener"><img decoding="async" class="aligncenter size-full wp-image-1505374" src="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Tom-Wittig-LinkedIn-Comment.png" alt="I've never clicked so fast lol. I have 5 customers asking about this." width="481" height="133" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Tom-Wittig-LinkedIn-Comment-200x55.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Tom-Wittig-LinkedIn-Comment-300x83.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Tom-Wittig-LinkedIn-Comment-400x111.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Tom-Wittig-LinkedIn-Comment.png 481w" sizes="(max-width: 481px) 100vw, 481px" /></a></p>
<p>That got me thinking, what if you have many sites to keep an eye on in Qlik SaaS? You would want to take the information from each site, place it into a common repository and then build an app over that. But how?</p>
<p>There are plenty of methods for storing files out, but this would require a shared DropBox or Google Drive, between clients, or many clients&#8217; accounts linked to by the partner. Neither of these approaches feels like a good idea. Pushing just the data that is required via a one way service that can then store the data would be ideal.</p>
<p><img decoding="async" class="alignright size-medium wp-image-1505371" src="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Qlik-Sense-Webhooks-Google-300x189.png" alt="IFTTT Qlik Sense Webhooks Google" width="300" height="189" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Qlik-Sense-Webhooks-Google-200x126.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Qlik-Sense-Webhooks-Google-300x189.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Qlik-Sense-Webhooks-Google-320x202.png 320w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Qlik-Sense-Webhooks-Google-400x252.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Qlik-Sense-Webhooks-Google-600x379.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Qlik-Sense-Webhooks-Google.png 634w" sizes="(max-width: 300px) 100vw, 300px" />Using a combination of the REST connector, Webhooks, <a href="https://ifttt.com/" target="_blank" rel="noopener">If This Then That</a> and Google Sheets it is simple to achieve this.</p>
<p>I did a previous post on using Webhooks to <a href="https://www.quickintelligence.co.uk/qlik-ifttt-iot/" target="_blank" rel="noopener">start a Sonos playlist when a new customer is obtained</a>, but this is a more practical application of the same technique.</p>
<h3>Signing Up For An IFTTT Account</h3>
<p>If This Then That allows you to connect all of the various services you have and get them talking to each other. It&#8217;s well worth taking a look through the various example applets that they have available. If you have an account already you will know this. If not, it is simple and quick to create one and get started.</p>
<p>Head along to <a href="https://ifttt.com/" target="_blank" rel="noopener">https://ifttt.com/</a>, here you can sign up with an email address or an Apple, Google or Facebook account. As we&#8217;re going to be using Google Sheets I&#8217;m going to use a Google account, you can take your pick though.</p>
<p><a href="https://ifttt.com/" target="_blank" rel="noopener"><img decoding="async" class="aligncenter size-full wp-image-1505354" src="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Sign-Up.png" alt="IFTTT Sign Up Page" width="378" height="144" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Sign-Up-200x76.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Sign-Up-300x114.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Sign-Up.png 378w" sizes="(max-width: 378px) 100vw, 378px" /></a></p>
<h3>Creating the IFTTT Applet</h3>
<p>Once you have signed up or signed in you will get to the main IFTTT page. You may want to take the time to take a look around, or you can just crack on and click the <strong>Create</strong> button.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505355" src="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Create-Button.png" alt="IFTTT Create Button" width="466" height="49" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Create-Button-200x21.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Create-Button-300x32.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Create-Button-400x42.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Create-Button-460x49.png 460w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Create-Button.png 466w" sizes="(max-width: 466px) 100vw, 466px" /></p>
<p>As the name suggests, basic apps all consist of a trigger (If This) and an action (Then That), click the <strong>Add</strong> button to set up the If</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505356" src="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/If-This-Then-That-Workflow.png" alt="If This Then That Workflow" width="357" height="168" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/If-This-Then-That-Workflow-200x94.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/If-This-Then-That-Workflow-300x141.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/If-This-Then-That-Workflow.png 357w" sizes="(max-width: 357px) 100vw, 357px" /></p>
<p>First you need to chose the service that you will use for the trigger. Search for and select Webhooks</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505357" src="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Search-For-Webhooks.png" alt="Search for IFTTT Webhooks" width="402" height="185" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Search-For-Webhooks-200x92.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Search-For-Webhooks-300x138.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Search-For-Webhooks-400x184.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Search-For-Webhooks.png 402w" sizes="(max-width: 402px) 100vw, 402px" /></p>
<p>Many of the services will have lots of different options here, but Webhooks just have one simple action &#8211; receive a web request. Click this.</p>
<p>Pretty much every service will require a connection to that service, this is true of Webhooks, so click the Connect button to do this. Most services will then require credentials (as you will see when we connect to Google Sheets in a moment), but Webhooks will just create the connection for you.</p>
<p>You will then be prompted to create a trigger, which you need to name. This name will be used when you call the Webhook, and it will be available when we create the event caused by the Webhook. Make sure you take a note of this name.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505358" src="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Capacity-Usage-Create.png" alt="Capacity Usage Create Trigger" width="378" height="232" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Capacity-Usage-Create-200x123.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Capacity-Usage-Create-300x184.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Capacity-Usage-Create.png 378w" sizes="(max-width: 378px) 100vw, 378px" /></p>
<p>When the name has been provided click the <strong>Create Trigger</strong> button.</p>
<p>With the trigger created you can now click the <strong>Add</strong> button for the action.</p>
<p>Now you need to search for and select <strong>Google Sheets</strong>.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505360" src="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Google-Sheets-Search.png" alt="Google Sheets Search" width="582" height="183" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Google-Sheets-Search-200x63.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Google-Sheets-Search-300x94.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Google-Sheets-Search-400x126.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/IFTTT-Google-Sheets-Search.png 582w" sizes="(max-width: 582px) 100vw, 582px" /></p>
<p>From here select <strong>Add Row To Spreadsheet</strong>. Again you will need to connect to the service, do this by clicking the <strong>Connect</strong> button. A popup will appear where you can sign into your Google account and authenticate IFTTT to work with it.</p>
<p>There are lots of other endpoints that you can use to write to, such as Slack, Twitter and Gmail. Choose and configure the one that best suits you.</p>
<p>For a Google Sheet you need to provide the name of the spreadsheet (clear the default one first) enter the values to enter into each cell of the spreadsheet (defaults here are fine) and specify which folder in your Google Drive you would like the spreadsheet to reside. Click <strong>Create Action</strong> when done.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505361" src="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Configure-Spreadsheet.png" alt="Configure Spreadsheet" width="266" height="379" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Configure-Spreadsheet-200x285.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Configure-Spreadsheet-211x300.png 211w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Configure-Spreadsheet.png 266w" sizes="(max-width: 266px) 100vw, 266px" /></p>
<p>That has now created the applet and you can click <strong>Continue</strong>.</p>
<h3>Using The New Applet</h3>
<p>After clicking continue you will be shown the default name for the applet. This will be a description of what it does. You can swap this for a more useful name if you like. Click the <strong>Finish</strong> button when you are happy with the name.</p>
<p>The applet is now present and working, but the issue is that you won&#8217;t know how to call it. Click on the Webhooks icon above the to the configuration screen.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505362" src="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Webhooks-Icon.png" alt="Webhooks Icon" width="72" height="74" /></p>
<p>From that screen click the <strong>Documentation</strong> button at the top right of the screen. This will take you to a screen where you can test your Webhook.</p>
<p>Replace the text <strong>{event}</strong> with the event name that you used when setting up the trigger. Enter some values into the three value text boxes and click <strong>Test It</strong>.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505363" src="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Test-The-Webhook.png" alt="Test The Webhook" width="554" height="360" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Test-The-Webhook-200x130.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Test-The-Webhook-300x195.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Test-The-Webhook-400x260.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Test-The-Webhook.png 554w" sizes="(max-width: 554px) 100vw, 554px" /></p>
<p>You will need to copy the Trigger URL to a safe place to be able to use it later, this is the one that looks like this:</p>
<p><strong>https://maker.ifttt.com/trigger/capacity_usage/with/key/ABCDE1234567890</strong></p>
<p>Once the test has been fired you should be able to go and find the spreadsheet, but I have noticed it can take a few minutes to appear.</p>
<h3>Plumbing The Webhook Into The App</h3>
<p>To use this Webhook with the Capacity Licence checking app I made available <a href="https://www.quickintelligence.co.uk/sense-capacity-licence-notify/">last week</a> you will need to download it from <a href="https://community.qlik.com/t5/Documents/Qlik-Sense-App-Monitor-Capacity-Licences-on-Qlik-Cloud-and/ta-p/1805633" target="_blank" rel="noopener">here</a>. To plumb it into another app you will need to put the values you want to send into variables in your load script.</p>
<p>To call the URL you will need a REST connection set up, as described in the previous blog post. This can point to any URL, as we are going to change it using WITH CONNECTION, I typically use <a href="https://jsonplaceholder.typicode.com/posts" target="_blank" rel="noopener">https://jsonplaceholder.typicode.com/posts</a> for this purpose. Give the connection the name <strong>GenericGET</strong>.</p>
<p>You then just need to add the following code after the point where the variables are set:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Send details to a Webhook
LIB CONNECT TO 'GenericGET';
SET errormode = 0;
SendResults:
SQL SELECT
"col_1"
FROM CSV (header off, delimiter ",", quote """") "CSV_source"
WITH CONNECTION (
URL "https://maker.ifttt.com/trigger/capacity_usage/with/key/ABCDE1234567890?value1=$(vUsed)&amp;value2=$(vRunRate)&amp;value3=$(vAvailable)");
SET errormode = 1;</code></pre>
<p>Obviously the key part of the URL will need to change to be your own personal Webhook key that you copied above. You will also need to ensure that the trigger name matches the one you gave when creating the trigger. The URL copied in the test step above didn&#8217;t have any parameters, as these were passed in the body of the GET request. You will need to manually type the three parameters to the URL and inject variable values created earlier in the script.</p>
<p>Once the load script has run you can check the result from the call of the Webhook by checking the <strong>col_1</strong> field in Analyze mode in Sense.</p>
<p>You should now have a new row in your spreadsheet with the values you specified in:</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505366" src="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Capacity-Usage-Spreadsheet.png" alt="Capacity Usage Spreadsheet" width="591" height="139" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Capacity-Usage-Spreadsheet-200x47.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Capacity-Usage-Spreadsheet-300x71.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Capacity-Usage-Spreadsheet-400x94.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Capacity-Usage-Spreadsheet.png 591w" sizes="(max-width: 591px) 100vw, 591px" /></p>
<p>As you can see you can insert a row which has headers and new rows will simply be appended to the end. If you have multiple Webhooks appending to the same spreadsheet you just need to ensure that you have a value in a column which shows which numbers have come from where.</p>
<p>Webhooks are a great way to ping small amounts of data between different services, and it is something which is going to be more closely integrated into Sense in future with <a href="https://www.qlik.com/us/products/blendr-io" target="_blank" rel="noopener">blendr.io</a>. You can start using them straight away though, from your load scripts.</p>
<p>Please let me know how you get on with them in the comments below.</p>
<p>The post <a href="https://www.quickintelligence.co.uk/ifttt-webhooks-qlik-cloud/">Use IFTTT and Webhooks to Send Data from Qlik Sense</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.quickintelligence.co.uk/ifttt-webhooks-qlik-cloud/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1505353</post-id>	</item>
		<item>
		<title>Monitor and Notify Sense Capacity Licence Usage in Qlik Cloud</title>
		<link>https://www.quickintelligence.co.uk/sense-capacity-licence-notify/</link>
					<comments>https://www.quickintelligence.co.uk/sense-capacity-licence-notify/#comments</comments>
		
		<dc:creator><![CDATA[Steve Dark]]></dc:creator>
		<pubDate>Wed, 05 May 2021 19:58:03 +0000</pubDate>
				<category><![CDATA[Qlik Sense Tutorials]]></category>
		<category><![CDATA[Examples]]></category>
		<category><![CDATA[Sense]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">https://www.quickintelligence.co.uk/?p=1505340</guid>

					<description><![CDATA[<p>Capacity licences are a great way of granting many, infrequent, users access to your Qlik apps. Monitoring usage of available capacity is critical though and is not immediately straightforward in Qlik Cloud (SaaS). This tutorial, and sample app, show how you can monitor usage and alert when usage is exceeding what is expected. What is  [...]</p>
<p>The post <a href="https://www.quickintelligence.co.uk/sense-capacity-licence-notify/">Monitor and Notify Sense Capacity Licence Usage in Qlik Cloud</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Capacity licences are a great way of granting many, infrequent, users access to your Qlik apps. Monitoring usage of available capacity is critical though and is not immediately straightforward in Qlik Cloud (SaaS). This tutorial, and sample app, show how you can monitor usage and alert when usage is exceeding what is expected.<br />
<span id="more-1505340"></span></p>
<h3>What is Capacity Licencing?</h3>
<p>Purchased in packs of 1,000 minutes per calendar month, a capacity licence is a subscription which can be consumed by any user for access to any app in six minute time slices. This flexibility makes the capacity licence an excellent choice for getting large numbers of infrequent users using Qlik apps.</p>
<p>Once you have these licences though, it is crucial that you monitor things to ensure that you are not burning through your capacity too quickly. Just looking at how many minutes have been consumed against the total is not enough, you need to be aware of how far through the month you are. Looking at current usage against a <a href="https://www.linkedin.com/pulse/improving-your-run-rate-steve-dark/" target="_blank" rel="noopener">run-rate</a> of available minutes allows this. If usage is exceeding the minutes available then someone needs to be notified, so licences can be reallocated or an additional capacity licence pack be added.</p>
<p>This post describes how to set up this monitoring and alerting on Qlik Cloud (SaaS). A similar approach can be taken for client managed also.</p>
<h3>Connecting To The Qlik API</h3>
<p>Information about your Qlik Cloud tenant is exposed through a number of <a href="https://qlik.dev/apis/" target="_blank" rel="noopener">API Endpoints</a>. In order to read from these endpoints <strong>API Keys</strong> need to be enabled under <strong>Management Console Settings</strong>, a nominated user must have <strong>Developer</strong> rights in the <strong>Users</strong> section of the Management Console, and that user needs to generate an API key in the <strong>API Keys</strong> section of their <strong>Profile Settings</strong>. This key is then used in the load script of the app.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505348" src="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/API-Keys.png" alt="API Key Settings" width="582" height="200" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/API-Keys-200x69.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/API-Keys-300x103.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/API-Keys-400x137.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/API-Keys.png 582w" sizes="(max-width: 582px) 100vw, 582px" /></p>
<p>This is quite a convoluted process, but it is well described in the documentation for the <a href="https://community.qlik.com/t5/Support-Updates/The-App-Analyzer-for-Qlik-SaaS-customers-is-available-NOW/ba-p/1734927" target="_blank" rel="noopener">App Analyzer for Qlik SaaS</a>. The analyzer app itself is one you may want to considering in your SaaS tenant.</p>
<p>Once you have an API key, paste it into a safe place as you will need it later.</p>
<p>To implement a similar solution on Qlik Sense Enterprise for Windows (Client Managed) you can use the provided REST connection, <strong>monitor_apps_REST_license_overview</strong>.</p>
<p>Rather than setting up a connection to each API that is needed in your SaaS environment, it makes more sense to create just one and then modify it using <a href="https://help.qlik.com/en-US/connectors/Subsystems/REST_connector_help/Content/Connectors_REST/Load-REST-data/Load-data.htm#WITH-CONNECTION-keyword" target="_blank" rel="noopener">WITH CONNECTION</a>. To enable this, set up a new REST connection, pointing to a placeholder (e.g. <a href="https://jsonplaceholder.typicode.com/posts" target="_blank" rel="noopener">https://jsonplaceholder.typicode.com/posts</a>) with the type set to GET and everything else as defaults. Give this connection the name GenericGET.</p>
<h3>Sending Alerts From The Qlik Load Script</h3>
<p>It is possible to use <a href="https://www.qlik.com/us/products/qlik-sense/data-alerts" target="_blank" rel="noopener">Qlik Alerting</a> in Qlik Cloud, but for this purpose I would suggest simply sending directly from the load script. The SMTP connector in Qlik Cloud allows for this.</p>
<p>Create a new SMTP connection, populating it with the details of the mail server you wish to send via. You may want to set up an email account, such as a <a href="https://accounts.google.com/" target="_blank" rel="noopener">free GMail account</a>, specifically for this purpose. Give this connection the default name of SMTP.</p>
<p>This will allow you to send custom emails from your Qlik load script. In order to do the same in Qlik Sense Enterprise for Windows see this previous blog post on <a href="https://www.quickintelligence.co.uk/send-data-from-qlik-load-script/" target="_blank" rel="noopener">Sending Data from the Qlik Load Script</a>.</p>
<h3>Building The Capacity Usage App</h3>
<p>As with any Qlik app, most of the magic happens in the load script. Here we talk through the code you need to build an alerts app.</p>
<p>First of all some environmental variables need to be set, specifying where your tenant can be found and what email settings you wish to use:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Name or alias of your Qlik Sense Cloud instance
let vInstance = 'instance.region.qlikcloud.com';

// Email configuration fields
let vTo = 'recipient@domain.com';
let vFrom = 'sender@domain.com';
let vFromName = 'Sense Capacity Alert';

// The API key to use - generated under your Profile settings
let vAPIKey = 'ABC123456789';</code></pre>
<p>Note that you will need to paste the API key that you obtained above into this code.</p>
<p>Now some options to configure. Firstly at what percentage of the time-of-month available minutes do you wish to alert, 1 is anything over 100% of usage &#8211; you can increase or decrease this as you wish. You can also specify how frequently you want to be reminded you are over threshold (if usage keeps rising) or ask to be reminded every time the app reloads:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Decimal at which run-rate percent to send alert - 1 = 100%
let vAlertAt = 1;

// Days in which to repeat send of alert - can be a decimal fraction of a day
let vRepeatIn = 0.25;

// Binary flag indicating whether you wish to ignore increase and repeat thresholds
let vSendAll = 0;</code></pre>
<p>Note that the repeat value of 0.25 is equivalent to every six hours. You can adjust as you see fit.</p>
<p>Now we need to connect to the REST connection. This will check your placeholder is present, but do nothing else at this point:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Connect to the REST connector
LIB CONNECT TO 'GenericGET';</code></pre>
<p>Note that if you have created your REST connection in a managed space, you will want to prefix the name with the space name, e.g. &#8216;MySpace:GenericGET&#8217;;.</p>
<p>Most of the heavy lifting of working out where we are in the month is done in this next statement. It connects to the API, gives the credentials defined above, calculates the run rate and formats the output:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Retrieve data and calculate run-rates and percentages
CapacityUsed:
LOAD
*,
num([Used Minutes] / [Available Run Rate], '#,##0.0%') as [Percent Used Run Rate]
;
LOAD
name as [Licence Type],
usageClass as [Usage Type],
units as [Total Minutes],
unitsUsed as [Used Minutes],
num(unitsUsed / units, '#,##0.0%') as [Percent Used],
// Work out a run rate by working out how far through the month we are in days,
// divided by the total number of days in the month
num(units *
((now() - MonthStart(today())) /
Day(MonthEnd(today()))), '#,##0.0') as [Available Run Rate],
overage
WHERE name = 'analyzer_time'
;
SQL SELECT
(SELECT
"name",
"usageClass",
"units",
"unitsUsed",
"overage"
FROM "allotments" FK "__FK_allotments")
FROM JSON (wrap on) "root" PK "__KEY_root"
WITH CONNECTION (
URL "https://$(vInstance)/api/v1/licenses/overview",
HTTPHEADER "Authorization" "Bearer $(vAPIKey)"
)
;</code></pre>
<p>In order to be able to check values and send them in the load script we need to <a href="https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/use-inter-record-functions.htm" target="_blank" rel="noopener">peek</a> them into variables:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Retrieve values from the data set
let vRunRate = num(peek('Percent Used Run Rate', -1, 'CapacityUsed'), '#,##0.0%');
let vTotal = num(peek('Total Minutes', -1, 'CapacityUsed'), '#,##0');
let vUsed = num(peek('Used Minutes', -1, 'CapacityUsed'), '#,##0');
let vPercent = num(peek('Percent Used', -1, 'CapacityUsed'), '#,##0.0%');
let vAvailable = num(peek('Available Run Rate', -1, 'CapacityUsed'), '#,##0.0');</code></pre>
<p>Then to give information back to the user running the script we can use these variables in a set of <a href="https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptRegularStatements/Trace.htm" target="_blank" rel="noopener">trace</a> statements.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Notify of current status to load stream
TRACE ;
TRACE $(vUsed) Minutes of $(vTotal) consumed.;
TRACE $(vPercent) of Total and $(vRunRate) of Run Rate minutes.;</code></pre>
<p>Capacity subscriptions reset at the end of each calendar month. We are only interested in being notified if the previous percentage usage has been exceeded, but we need to reset that if we are in a new month. That is done here:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Reset last run rate if we are in a new month
if Month(alt(vLastRun, 0)) &lt; &gt; month(today()) then
let vLastRunRate = 0;
end if</code></pre>
<p>We then need to decide whether the current run-rate exceeds the value at which we want to alert, and whether other criteria such as used percentage increased and interval time elapsed. This is all in one big if statement:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Check if we have an alert situation and whether repeat and increase criteria met
if vRunRate &gt; vAlertAt and (vSendAll &lt; &gt; 0
or (vRunRate &gt; alt(vLastRunRate, 0) and now() &gt; alt(vLastAlert + vRepeatIn, 0))) then</code></pre>
<p>Now we have to set a couple of variables, to record what level we are alerting at, and when we are doing it. We are also writing to the load script progress window:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs"> TRACE Sending alert to $(vTo);

// Set variables to log last time an alert sent
let vLastRunRate = vRunRate;
let vLastAlert = now();</code></pre>
<p>Sending emails from the Qlik SaaS load script requires a connection to the SMTP connection to be made:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Connect to SMTP connection
LIB CONNECT TO 'SMTP';</code></pre>
<p>As with the REST connection, the connection name should be prefixed with the space name and a colon if the connection is in a managed space.</p>
<p>Then the sending of an email is simply a LOAD call, with the recipient, sender, subject and body of the email all included in the SELECT statement:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs"> // Send email and retrieve result of send
Email:
LOAD
status as [Email Status],
result as [Email Result]
;
SELECT
status,
result
FROM SendEmail
WITH PROPERTIES (
to='$(vTo)',
subject='Capacity Usage Exceeding Expected For Time Of Month ($(vRunRate))',
message='

The capacity licence usage on <b>$(vInstance)</b> is currently <b>$(vUsed)</b> minutes out of <b>$(vTotal)</b>.
This is <b>$(vPercent)</b> of the total capacity, and <b>$(vRunRate)</b> of the minutes pro-rata for the time of month.',
html='true',
fromName='$(vFromName)',
fromEmail='$(vFrom)',
cc='',
bcc=''
);</code></pre>
<p>Note that you can place HTML into the body of the message here (due to the html=&#8217;true&#8217; flag). The code above will be missing the line break and bold tags, you can simply add them back in as required.</p>
<p>The response from the email server is kept in the Email table. We are not looking into that here, but you can check the values in these fields in the Analyze part of your app.</p>
<p>We then need to end if the IF statement we started above, and clear down the variables we have used and no longer have a need of:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">end if

// Clean up after ourselves
let vInstance = ;
let vTo = ;
let vFrom = ;
let vFromName = ;
let vAPIKey = ;
let vAlertAt = ;
let vRepeatIn = ;
let vSendAll = ;</code></pre>
<p>So, all being well that should be that. Your tenant&#8217;s API will be polled, capacity usage will be loaded (note other licences are in that endpoint also, just excluded by a WHERE), run rates will be calculated and emails will be sent.</p>
<p>Seeing the data is in a Sense app though, it would be a shame not to have a chart or two&#8230;</p>
<h3>Building a Front End for the Application</h3>
<p>This application will only have one row of data in it and a handful of fields that can be used for measures. Master measures can be made for these, as follows:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeexp">Total Capacity: Sum([Total Minutes])
Used Minutes: Sum([Used Minutes])
Capacity Run Rate: Sum([Available Run Rate])
Percent of Total Used: Sum([Used Minutes]) / Sum([Total Minutes])
Percent of Run Rate Used: Sum([Used Minutes]) / Sum([Available Run Rate])</code></pre>
<p>You might then chose to place these onto a sheet a bit like this:</p>
<p><img decoding="async" class="aligncenter size-fusion-600 wp-image-1505344" src="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Qlik-Cloud-Capacity-Usage-600x388.png" alt="Qlik Cloud Capacity Usage Dashboard" width="600" height="388" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Qlik-Cloud-Capacity-Usage-200x129.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Qlik-Cloud-Capacity-Usage-300x194.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Qlik-Cloud-Capacity-Usage-400x259.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Qlik-Cloud-Capacity-Usage-600x388.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Qlik-Cloud-Capacity-Usage-768x497.png 768w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Qlik-Cloud-Capacity-Usage-800x518.png 800w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/05/Qlik-Cloud-Capacity-Usage.png 927w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<p>If after all of this you would rather just download an app that already has all of the script and front end in it, then you are in luck. I have uploaded the completed app to <a href="https://community.qlik.com/">Qlik Community</a> and you can find it here:<br />
<a href="https://community.qlik.com/t5/Qlik-Sense-Documents/Qlik-Sense-App-Monitor-Capacity-Licences-on-Qlik-Cloud-and/ta-p/1805633" target="_blank" rel="noopener">https://community.qlik.com/t5/Qlik-Sense-Documents/Qlik-Sense-App-Monitor-Capacity-Licences-on-Qlik-Cloud-and/ta-p/1805633</a></p>
<p>I would be very interested to hear how you get on with this application. Please feel free to contact me via the comments if you wish to get in touch.</p>
<h3>Expanding The Solution</h3>
<p>If you want to take this solution further, and write the capacity usage as at each reload to an online source, you may want to read my next blog post also:</p>
<p><a href="https://www.quickintelligence.co.uk/ifttt-webhooks-qlik-cloud/">Use IFTTT and Webhooks to Send Data from Qlik Sense</a></p>
<p>The post <a href="https://www.quickintelligence.co.uk/sense-capacity-licence-notify/">Monitor and Notify Sense Capacity Licence Usage in Qlik Cloud</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.quickintelligence.co.uk/sense-capacity-licence-notify/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1505340</post-id>	</item>
		<item>
		<title>Loading Data from Online CSV Sources into Qlik</title>
		<link>https://www.quickintelligence.co.uk/load-online-csv-into-qlik/</link>
					<comments>https://www.quickintelligence.co.uk/load-online-csv-into-qlik/#respond</comments>
		
		<dc:creator><![CDATA[Steve Dark]]></dc:creator>
		<pubDate>Fri, 08 Jan 2021 10:17:30 +0000</pubDate>
				<category><![CDATA[Instant App]]></category>
		<category><![CDATA[Load Script]]></category>
		<category><![CDATA[Qlik Sense Tutorials]]></category>
		<category><![CDATA[csv]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[qlik sense]]></category>
		<guid isPermaLink="false">https://www.quickintelligence.co.uk/?p=1505308</guid>

					<description><![CDATA[<p>There are myriad different data sources out there, and it is possible to load any of them into Qlik. Some are easier than others, sure, but there is always a way. There are good articles and posts on some of the trickier sources, but today I want to show you how you can bring in  [...]</p>
<p>The post <a href="https://www.quickintelligence.co.uk/load-online-csv-into-qlik/">Loading Data from Online CSV Sources into Qlik</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>There are myriad different data sources out there, and it is possible to load any of them into Qlik. Some are easier than others, sure, but there is always a way. There are good articles and posts on some of the trickier sources, but today I want to show you how you can bring in CSV data from GitHub. This means you can pull up to date, crowdsourced and governed data directly into your applications, just by following these simple steps.<br />
<span id="more-1505308"></span></p>
<h3>Introducing The CSV Data</h3>
<p>Recently I was asked to be involved with the <a href="https://dataonthe.earth/" target="_blank" rel="noopener noreferrer">Data On The Earth</a> project. This is an initiative to get data that can help everyone, from policy makers to concerned individuals, make more informed decisions about environmental issues. Naturally, I was very happy to help.</p>
<p><a href="https://dataonthe.earth/"><img decoding="async" class="aligncenter size-full wp-image-1505317" src="https://www.quickintelligence.co.uk/wp-content/uploads/2021/01/DataOnTheEarth.png" alt="Data On The Earth" width="550" height="96" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2021/01/DataOnTheEarth-200x35.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/01/DataOnTheEarth-300x52.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/01/DataOnTheEarth-400x70.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/01/DataOnTheEarth.png 550w" sizes="(max-width: 550px) 100vw, 550px" /></a></p>
<p>The first thing I wanted to do was to present some ideas over some data that had relevance to the job in hand. The site <a href="https://ourworldindata.org/" target="_blank" rel="noopener noreferrer">Our World In Data</a> seemed like a good place to start.</p>
<p><img decoding="async" class="alignright size-medium wp-image-1505318" src="https://www.quickintelligence.co.uk/wp-content/uploads/2021/01/OctoCatMap-300x189.png" alt="GitHub OctoCat Map" width="300" height="189" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2021/01/OctoCatMap-200x126.png 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/01/OctoCatMap-300x189.png 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/01/OctoCatMap-320x202.png 320w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/01/OctoCatMap-400x253.png 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/01/OctoCatMap-600x379.png 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2021/01/OctoCatMap.png 640w" sizes="(max-width: 300px) 100vw, 300px" />There I found data which related to Co2 emissions, hosted on <a href="https://github.com/" target="_blank" rel="noopener noreferrer">GitHub</a>, you can find more about these data <a href="https://ourworldindata.org/co2-and-other-greenhouse-gas-emissions" target="_blank" rel="noopener noreferrer">here</a>. The data are by Country and Year, so a bit of extra metadata on the countries would allow some demographic filtering. I found this in two further CSV files, also conveniently hosted on GitHub.</p>
<p>The data are not perfect, as some of the figures are not reported by all countries in every year and countries change over time. There are things that could be done to fix this up a bit (rolling forward last known figures, for instance), but I have not done that here. If you are planning to lobby a government over their emissions (or something) please check your facts and don&#8217;t rely on what is presented in these data alone!</p>
<h3>Creating a Connection</h3>
<p>The code in this article is for the load script of Qlik Sense. You can do similar with the REST connector in QlikView, but the syntax is a bit different, this post should give you pointers should you wish to build your own load script.</p>
<p>As with any load script in Sense you first need to have your connection created. Rather than create a separate connection for each data source I load I tend to create a generic connection of each type required and modify it using <a href="https://help.qlik.com/en-US/connectors/Subsystems/REST_connector_help/Content/Connectors_REST/Load-REST-data/Load-data.htm#WITH-CONNECTION-keyword" target="_blank" rel="noopener noreferrer">WITH CONNECTION</a>. You may already have the required connection set up if you have previously followed my tutorials on <a href="https://www.quickintelligence.co.uk/sense-session-logs/" target="_blank" rel="noopener noreferrer">Loading Sense Session Logs</a> or <a href="https://www.quickintelligence.co.uk/reading-rss-feeds-with-qlik-rest-connector/" target="_blank" rel="noopener noreferrer">Loading RSS Feeds</a>, if not go to the <strong>Data Load Editor</strong> and click <strong>Create New Connection</strong>.</p>
<p>Give your connection the name <strong>GenericGET</strong> and point it to a placeholder, such as <a href="https://jsonplaceholder.typicode.com/posts" target="_blank" rel="noopener noreferrer">https://jsonplaceholder.typicode.com/posts</a>, ensure the Method is set to <strong>GET</strong> and leave everything else as defaults.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505262" src="https://www.quickintelligence.co.uk/wp-content/uploads/2020/07/GenericGet-Connection.jpg" alt="Config screen for GenericGET connection" width="428" height="238" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2020/07/GenericGet-Connection-200x111.jpg 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/07/GenericGet-Connection-300x167.jpg 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/07/GenericGet-Connection-400x222.jpg 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/07/GenericGet-Connection.jpg 428w" sizes="(max-width: 428px) 100vw, 428px" /></p>
<p>Click on <strong>Test Connection</strong>, then <strong>Close</strong> and finally (if all is good) <strong>Create</strong>.</p>
<h3>Building the Load Script</h3>
<p>Now, onto building the load script. First we need to do some set up, to connect to our connection and set up some variables:</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">LIB CONNECT TO 'GenericGET';

let vCompleteYears = 'Y'; // Y/N for all years or only 1990 - 2016 where data is quite complete
let vExcludeYears = if(upper(left(vCompleteYears, 1)) = 'Y', 'AND (year &gt;= 1990 AND year &lt;= 2016)', '');

set vFix = if([$1] = '', '$3', [$1]) as [$2];

let v1B = 1000000000;
let v1M = 1000000;</code></pre>
<p>The first variable allows us to turn on or off data for years which are not that complete, the second puts the code to implement that into a variable if switched on. Next we have a variable which includes parameters that we will use later on. If you have not used them before you should see this post on <a href="https://www.quickintelligence.co.uk/variables-parameters-load-script/" target="_blank" rel="noopener noreferrer">Using Parameters with Qlik Variables</a>. Finally a couple of variables to remove the risk of typing the wrong number of zeros later on.</p>
<p>Now we are set up, we can do the main part of the load.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">Emissions:
LOAD
iso_code &amp; year as CountryYear,
iso_code as [Country ISO],
country as Country,
year as Year,
co2 as CO2,
consumption_co2 as [CO2 Consumption],
trade_co2 as [CO2 Trade],
co2_per_unit_energy as [CO2 Per Unit Energy],
cement_co2 as [CO2 Cement],
coal_co2 as [CO2 Coal],
flaring_co2 as [CO2 Flaring],
gas_co2 as [CO2 Gas],
oil_co2 as [CO2 Oil],
total_ghg as [Total GHG],
methane as Methane,
nitrous_oxide as [Nitrous Oxide],
population as Population,
gdp as GDP
WHERE iso_code &lt;&gt; '' and index(iso_code, '_') = 0 // Remove rolled up values
$(vExcludeYears)
;
SQL SELECT
"iso_code",
"country",
"year",
"co2",
"consumption_co2",
"trade_co2",
"co2_per_unit_energy",
"cement_co2",
"coal_co2",
"flaring_co2",
"gas_co2",
"oil_co2",
"total_ghg",
"methane",
"nitrous_oxide",
"population",
"gdp"
FROM CSV
(header on, delimiter ",", quote """") "CSV_source"
WITH CONNECTION
(URL "https://raw.githubusercontent.com/owid/co2-data/master/owid-co2-data.csv")
;</code></pre>
<p>As with a database load this load will use the last opened connection. The <strong>CSV</strong> on the FROM line is specifying the basic format that we are loading from this connection, the exact format of the CSV is specified in the brackets &#8211; just as it would be if you were loading the CSV from a Folder Connection. The <strong>CSV_Source</strong> relates to which data source at the connection you wish to load &#8211; with a CSV this will only ever be CSV_source, but with JSON data there may be many named sets of data for you to choose from. The <strong>WITH CONNECTION</strong> then defines the URL we are loading from.</p>
<p>To explore these options further create another connection, pointing to that URL and look at the <strong>Select Data</strong> dialog for that connection.</p>
<p>Atop of the REST load we have a <a href="https://www.quickintelligence.co.uk/preceding-load-qlikview/" target="_blank" rel="noopener noreferrer">Preceding Load</a>, to tidy the fieldnames and remove data we don&#8217;t want. There are rows with data rolled up to regional levels, but we are going to do that ourselves in Qlik so need to remove the roll ups to avoid double counting. Note that when doing a <strong>WHERE</strong> in a preceding load all of the data still has to come down from the REST source first, so you may want to look if you can pass parameters to the URL you are loading from to drop some data, rather than using a WHERE statement.</p>
<p>So, that is the data we require from our main data source. We are going to continue though, and augment and categorise these data some more.</p>
<h3>Bringing in more CSV Data</h3>
<p>The next table of data is a simple table of country demographics, provided by GitHub, keyed on the ISO code for the country.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">Region:
LOAD
[ISO3166-1-Alpha-3] as [Country ISO],
$(vFix(Developed / Developing Countries, Developed, Not Known)),
$(vFix(Region Name, Region, Other)),
$(vFix(Sub-region Name, Sub Region, Other))
WHERE EXISTS ([Country ISO], [ISO3166-1-Alpha-3])
;
SQL SELECT
"ISO3166-1-Alpha-3",
"Developed / Developing Countries",
"Region Name",
"Sub-region Name"
FROM CSV (header on, delimiter ",", quote """") "CSV_source"
WITH CONNECTION
(URL "https://raw.githubusercontent.com/datasets/country-codes/master/data/country-codes.csv");</code></pre>
<p>This file has many more columns than we need, but we are cherry picking the few that we want. As you can see, the code for connecting to a CSV source is almost identical to above &#8211; just the URL is changing. In the Preceding load the <strong>vFix</strong> variable we created at the start is being used to replace any missing values with Not Known or Other. A WHERE EXISTS ensures we only get rows which relate to countries we have emissions data for.</p>
<p>Using a lookup table like this from a repository like GitHub in your Qlik apps means that your application will benefit from improvements to that dataset over time, rather than having a CSV or Excel spreadsheet languishing on your server which will never see an update.</p>
<h3>Where In The World Is That?</h3>
<p>As we are looking at country data it would be great to plot that on a map, and another GitHub source has just that information available for us. These data are provided and maintained by <a href="https://codeme.lt/" target="_blank" rel="noopener noreferrer">Tadas Tamošauskas</a> in a personal repo.</p>
<p>Here we are going to LEFT JOIN the data onto the existing region table, bringing the latitude/longitude data into the same table as the regions. You will see why in a bit.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">LEFT JOIN (Region)
LOAD
*,
GeoMakePoint(lat,long) as [Country Point]
;
LOAD
purgechar([Alpha-3 code], ' "') as [Country ISO],
purgechar([Latitude (average)], ' "') as lat,
purgechar([Longitude (average)], ' "') as long
WHERE EXISTS ([Country ISO], purgechar([Alpha-3 code], ' "'))
;
SQL SELECT
"Alpha-3 code",
"Latitude (average)",
"Longitude (average)"
FROM CSV (header on, delimiter ",", quote """") "CSV_source"
WITH CONNECTION
(URL "https://gist.githubusercontent.com/tadast/8827699/raw/f5cac3d42d16b78348610fc4ec301e9234f82821/countries_codes_and_coordinates.csv");</code></pre>
<p>This now lets us plot emissions data on a map by country. Our second data source though gave us <strong>Region</strong> and <strong>Sub Region</strong> names. It would be good if we could also plot by those regions. There is probably a data source out there which has SVG data for each region, but that could take a while to find and will not necessarily map to our existing region names.</p>
<p>We can apply a simple hack to generating points at each of the regions though.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">RegionPoint:
LOAD
Region,
GeoMakePoint(avg(lat),avg(long)) as [Region Point]
RESIDENT Region
GROUP BY Region;

SubRegionPoint:
LOAD
[Sub Region],
GeoMakePoint(avg(lat),avg(long)) as [Sub Region Point]
RESIDENT Region
GROUP BY [Sub Region];</code></pre>
<p>Here, a couple of RESIDENT loads from the existing Region table can be grouped to give one row per Region and Sub Region. For each of these rows the average latitude and average longitude can be calculated. These two values can then be changed to a point that can be easily used on a map. Note that some points may appear in the ocean, but that is the joy of using averages.</p>
<h3>Finding Latest Data and Grouping Figures</h3>
<p>The figures from our initial dataset are great for trending over time as they are provided on an annual basis. They are not so great for categorical data and providing filters though, as a country could move from one bucket to another year to year. For these filters we only want to use the latest figures. Here we hit another minor snag though, in that the last year in which data is available differs by country.</p>
<p>We can deal with this by finding the latest year for each country, using a RESIDENT, GROUP BY and MAX to create a composite key.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">LatestPop:
LOAD
[Country ISO] &amp; Year as LatestPop
;
LOAD
[Country ISO],
max(Year) as Year
RESIDENT Emissions
WHERE Population &lt;&gt; ''
GROUP BY [Country ISO];</code></pre>
<p>That composite key can then be used in the WHERE EXISTS of a subsequent RESIDENT load to only bring the latest data.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">Population:
LOAD
Country,
Population as [Population Latest],
dual(num(Round(Population, 100000) / $(v1M), '#,##0.0') &amp; 'M', Round(Population, 100000)) as [Population 100K],
dual(num(Round(Population, $(v1M)) / $(v1M), '#,##0') &amp; 'M', Round(Population, $(v1M))) as [Population 1M],
dual(num(Round(Population, $(v1M)0) / $(v1M), '#,##0') &amp; 'M', Round(Population, $(v1M)0)) as [Population 10M]
RESIDENT Emissions
WHERE EXISTS (LatestPop, CountryYear);</code></pre>
<p>This is a useful technique, and one I use frequently in live projects. As well as getting the exact number for the latest year for each country we can also put things into buckets. This can be done with a massive IF statement or for equal buckets an aggregation. Here I have used a <strong>Round</strong> statement, but you could use a <strong>Floor</strong> or <strong>Ceil</strong> if you prefer. The <a href="https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/round.htm" target="_blank" rel="noopener noreferrer">Round</a> function in Qlik is more flexible than in most languages as, rather than just rounding to a number of decimal places, you can specify what grouping you wish to go to, whether that is more or less than one.</p>
<p>The same technique can then be used for GDP, then there is just a little bit of housekeeping to do at the end of our script.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">LatestGDP:
LOAD
[Country ISO] &amp; Year as LatestGDP
;
LOAD
[Country ISO],
max(Year) as Year
RESIDENT Emissions
WHERE GDP &lt;&gt; ''
GROUP BY [Country ISO];

GDP:
LOAD
Country,
GDP as [GDP Latest],
dual(num(Round(GDP, $(v1B)), '#,##0') / $(v1B) &amp; 'B', Round(GDP, $(v1B))) as [GDP 1B],
dual(num(Round(GDP, $(v1B)0), '#,##0') / $(v1B) &amp; 'B', Round(GDP, $(v1B)0)) as [GDP 10B],
dual(num(Round(GDP, $(v1B)00), '#,##0') / $(v1B) &amp; 'B', Round(GDP, $(v1B)00)) as [GDP 100B]
RESIDENT Emissions
WHERE EXISTS (LatestGDP, CountryYear);

DROP FIELDS lat, long, LatestPop, LatestGDP;</code></pre>
<p>So, that is it. Put all those bits of script together and you should have a working load script to bring in emissions and demographic data from three separate online CSV sources.</p>
<p>Now you just need a quick way to analyse those data. Fortunately we have your back there.</p>
<h3>Viewing The Data In The Instant Sense Application</h3>
<p>To make it quick for us at Quick Intelligence to produce Proof Of Concepts for potential clients I created the Instant Sense Application. This application allows you to load any data source, and a spreadsheet of metadata about that data source, and then explore the data over twelve sheets of user configurable visualisations and tables.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505265" src="https://www.quickintelligence.co.uk/wp-content/uploads/2020/07/Instant-Sense-Application-Thumbs-Blog.jpg" alt="Instant Sense Application Thumbs Blog" width="600" height="240" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2020/07/Instant-Sense-Application-Thumbs-Blog-200x80.jpg 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/07/Instant-Sense-Application-Thumbs-Blog-300x120.jpg 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/07/Instant-Sense-Application-Thumbs-Blog-400x160.jpg 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/07/Instant-Sense-Application-Thumbs-Blog.jpg 600w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<p>We have made this application available to all, at no cost, to make it quick and easy for others to showcase what Qlik Sense is capable of.</p>
<p>The application can be downloaded from here:</p>
<p><a href="https://www.quickintelligence.co.uk/instant-qlik-sense-app/" target="_blank" rel="noopener noreferrer">The Quick Intelligence Instant Sense Application</a></p>
<p>Details of how the application has been built can be found here:</p>
<p><a href="https://www.quickintelligence.co.uk/instant-qlik-sense-application/" target="_blank" rel="noopener noreferrer">How To Build A User Configurable Sense Application</a></p>
<p>If you already have the application, or if you just want the script above, you can download the script and meta-data here:</p>
<p><a href="https://www.quickintelligence.co.uk/isa/emissions.zip" target="_blank" rel="noopener noreferrer">Global Emissions Data By Year with Metadata</a></p>
<p>If you use the application and build more expressions that you feel will be useful for others, please share them in the comments below. As ever, I&#8217;m happy to receive questions and comments from readers, and will get back to these as soon as I am able.</p>
<p>The post <a href="https://www.quickintelligence.co.uk/load-online-csv-into-qlik/">Loading Data from Online CSV Sources into Qlik</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.quickintelligence.co.uk/load-online-csv-into-qlik/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1505308</post-id>	</item>
		<item>
		<title>Analysing Sense Session Logs</title>
		<link>https://www.quickintelligence.co.uk/sense-session-logs/</link>
					<comments>https://www.quickintelligence.co.uk/sense-session-logs/#comments</comments>
		
		<dc:creator><![CDATA[Steve Dark]]></dc:creator>
		<pubDate>Thu, 20 Aug 2020 18:38:04 +0000</pubDate>
				<category><![CDATA[Instant App]]></category>
		<category><![CDATA[Qlik Sense Tutorials]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[Sense]]></category>
		<category><![CDATA[session logs]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">https://www.quickintelligence.co.uk/?p=1505281</guid>

					<description><![CDATA[<p>There are a number of monitoring apps that ship with Qlik Sense Enterprise on Premise, some of which you need to upload to your site. All of these are black-boxes to an extent though. What if you want to build your own analysis over the Sense log files? Well, this blog post has you covered.  [...]</p>
<p>The post <a href="https://www.quickintelligence.co.uk/sense-session-logs/">Analysing Sense Session Logs</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>There are a number of monitoring apps that ship with Qlik Sense Enterprise on Premise, some of which you need to upload to your site. All of these are black-boxes to an extent though. What if you want to build your own analysis over the Sense log files? Well, this blog post has you covered.<br />
<span id="more-1505281"></span></p>
<h3>Logging on Qlik Sense Enterprise</h3>
<p>With the default settings on logs in Sense Enterprise get written to two locations. One for the log file currently being written to and then an archive, where the current log is moved to periodically. By loading from both of those sources you get a good picture of what is going on with usage on your site. Connections are created to these two locations, named <strong>ServerLogFolder</strong> and <strong>ArchivedLogsFolder</strong>. There is a reasonable chance that you won&#8217;t see these connections in the Load Script Editor, so you will need to first go into the QMC and grant yourself rights &#8211; be careful not to grant more rights than you intend to when doing this!</p>
<p>Once you have access to these connections you can dig around and find out quite a lot about your system and how it is performing. This post, however, just focuses on the most important information. Who has done what and when.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505282" src="https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Session-Stats.jpg" alt="Qlik Session Stats" width="1209" height="704" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Session-Stats-200x116.jpg 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Session-Stats-300x175.jpg 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Session-Stats-400x233.jpg 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Session-Stats-600x349.jpg 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Session-Stats-768x447.jpg 768w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Session-Stats-800x466.jpg 800w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Session-Stats-1024x596.jpg 1024w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Session-Stats-1200x699.jpg 1200w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Session-Stats.jpg 1209w" sizes="(max-width: 1209px) 100vw, 1209px" /></p>
<h3>Sense Session Log Load Script</h3>
<p>Once you have permissions to the connections set up you can enter the <strong>Data Load Editor</strong> and start building your script.</p>
<p>First you need to set a couple of variables, which form part of the path to the session files. The first of these is generally the machine name, so can be left as is. The second tends to be a combination of the machine name and the local domain. You will need to click on the <strong>Select Data</strong> button underneath the connection name to confirm the path if its not what is expected.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Set variables which identify this server and form part of the log names
// Check in the ServerLogFolder and ArchivedLogsFolder to find the values for your installation
let vServerName = ComputerName();
let vFullServerName = 'servername.domain.local'; // Usually FQDN</code></pre>
<p>The next set of variables are then constructed from the connection name (which is usually the same in each installation) and the two variables you set above.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Build out file paths and file masks based on the variables above
let vCurLog = 'lib://ServerLogFolder/';
let vLogFolder = 'lib://ArchivedLogsFolder/$(vFullServerName)/';
let vCurFile = '$(vCurLog)Engine/Trace/$(vServerName)_Session_Engine.txt';
let vArchiveFiles = '$(vLogFolder)Engine/Trace/$(vServerName)_Session_Engine_*.log';</code></pre>
<p>As you would expect, there are a number of dates in the log file. Because the log is in a text file, rather than a database table, the dates are in plain text. This means they each need to be converted to dual-datatype dates so they can be used. The code for each of the conversions would need to be repeated, so here is a parameterised variable to do the job. If you have not used variables with parameters before you may want to see this <a href="https://www.quickintelligence.co.uk/variables-parameters-load-script/">previous blog post</a>.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Create parameterised variables for repeated tasks
set vDT = Date(Date#(left(replace($1, 'T', ' '), 15), 'YYYYMMDD hhmmss'), 'DD MMM YYYY hh:mm:ss');</code></pre>
<p>The filename for the current log file has been built into a variable. Just in case we are between log files at this point we are going to check first that it exists. If it does we can bring the fields that we want from the file. If you are a completest you may want to look to the source file and bring through the fields I have dropped. This is pretty much everything that is interesting though.</p>
<p>Note that I am excluding sessions relating to reloads by the Sense Distribution service. If you are looking for log-jams on CPU use at specific times of day you may want to include these rows, but for most analysis they are not useful.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Load the raw data from the current file
if alt(FileSize('$(vCurFile)'), 0) &gt; 0 then
Temp_Sessions:
LOAD
ActiveUserId,
[App Title],
[Session Start],
[Exit Reason],
Level,
Hostname,
ServiceUser,
ActiveUserDirectory,
Timestamp,
[Exe Version],
[Server Started],
AppId,
[Doc Timestamp],
[Authenticated User],
[Secure Protocol],
[Session Duration],
[CPU Spent (s)],
[Bytes Received],
[Bytes Sent],
Calls,
Selections
FROM [$(vCurFile)]
(txt, utf8, embedded labels, delimiter is '\t', msq)
// Ignoring reload sessions. Remove next line if you want all sessions
WHERE ActiveUserId &lt;&gt; 'sa_scheduler' and ActiveUserId &lt;&gt; 'sa_repository'
;
end if</code></pre>
<p>For the archive log files we need to enumerate around all of the files in the archive folder. Again, we already have the file-mask in a variable, so can just use this. You may be aware that a load can be done directly from a filename with an asterisk in it, to load all matching files. Personally, I would always use a <strong><a href="https://help.qlik.com/en-US/sense/June2020/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptControlStatements/For%20Each.htm" target="_blank" rel="noopener noreferrer">for each</a></strong> loop, as it makes debugging and testing easier. You can also exclude files (such as files with a tilde when loading Excel files) and work with the <strong><a href="https://help.qlik.com/en-US/sense/June2020/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptPrefixes/crosstable.htm" target="_blank" rel="noopener noreferrer">CROSSTABLE</a></strong> statement, which fails when used with an asterisk in the file name.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Concatenate onto the temporary table the raw data from all of the archive files
// Strongly suggest building an archive of QVD files for historical logs and
// concatenate these at the end of the process - this is not done in this example though
for each vFile in FileList('$(vArchiveFiles)')
Temp_Sessions:
LOAD
ActiveUserId,
[App Title],
[Session Start],
[Exit Reason],
Level,
Hostname,
ServiceUser,
ActiveUserDirectory,
Timestamp,
[Exe Version],
[Server Started],
AppId,
[Doc Timestamp],
[Authenticated User],
[Secure Protocol],
[Session Duration],
[CPU Spent (s)],
[Bytes Received],
[Bytes Sent],
Calls,
Selections
FROM [$(vFile)]
(txt, utf8, embedded labels, delimiter is '\t', msq)
// Ignoring reload sessions. Remove next line if you want all sessions
WHERE ActiveUserId &lt;&gt; 'sa_scheduler' and ActiveUserId &lt;&gt; 'sa_repository'
;
next</code></pre>
<p>You should now have a single table with all of the log entries that are needed for analysis. There are a number of transformations and general tidying up that is required. This is done by doing a <strong><a href="https://help.qlik.com/en-US/sense/June2020/Subsystems/Hub/Content/Sense_Hub/Scripting/load-data-from-previously-loaded-table.htm" target="_blank" rel="noopener noreferrer">RESIDENT</a></strong> load from our raw-data temporary table.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Format all raw values, calculate new values and rename fields
Sessions:
LOAD
1 as SessionCount,
*,
Date(DayStart([Session Start]), 'DD MMM YYYY') as Date,
Date(MonthStart([Session Start]), 'MMM YYYY') as Month,
Year([Session Start]) as Year,
Month([Session Start]) as [Month Name],
Hour([Session Start]) as Hour,
WeekDay([Session Start]) as Day,
Time(Round(
[Session Start] - DayStart([Session Start]),
(1/288)), 'hh:mm') as Time, // nearest 5min
Floor([Session Start] - [Server Started]) as [Days Since Server Start],
Floor(([Session End] - [Document Reloaded]) * 24) as [Hours Since Document Reload],
Round([Bytes Received] * 1024, 1) as [KB Received],
Round([Bytes Sent] * 1024, 1) as [KB Sent]
;
LOAD
ActiveUserId as User,
[App Title] as Application,
$(vDT([Session Start])) as [Session Start],
[Exit Reason],
Level,
Hostname,
ServiceUser as [Service User],
ActiveUserDirectory as [User Directory],
$(vDT(Timestamp)) as [Session End],
[Exe Version] as [Server Version],
$(vDT([Server Started])) as [Server Started],
AppId,
$(vDT([Doc Timestamp])) as [Document Reloaded],
[Authenticated User],
[Secure Protocol],
rangemin([Session Duration], 0.5) as [Session Duration], // clip as error can cause incorrect duration
[CPU Spent (s)],
[Bytes Received],
[Bytes Sent],
Calls,
Selections
RESIDENT Temp_Sessions
;</code></pre>
<p>There&#8217;s quite a bit going on in the script above, so to take it one bit at a time&#8230; Field names are being renamed to make them more &#8216;friendly&#8217; for end-users. The date variable created above is being applied to all date fields. I found the session duration occasionally has duff values (if a session looks to be resumed), so those are capped at 12 hours. A number of new fields are added in the preceding load, including a counter (something I always to to make things more efficient), all of the date parts and some derived values for further calculations.</p>
<p>As should always be done at the end of load scripts, there is then some tidying up of tables and variables to do.</p>
<pre class="qlik-highlight-pre"><code class="qlik-highlight-codeqvs">// Drop the temporary table
DROP TABLE Temp_Sessions;

// Clean up all the variables we have used
let vServerName = ;
let vFullServerName = ;
let vCurLog = ;
let vLogFolder = ;
let vCurFile = ;
let vArchiveFiles = ;
let vCurFile = ;
let vFile = ;</code></pre>
<p>And there you have it. Your Sense Enterprise log file, loaded, cleaned and ready to analyse.</p>
<h3>So, How Do I Analyse My Sense Logs?</h3>
<p>Obviously, you can build your own charts and tables over these data, but wouldn&#8217;t it be simpler if there was a pre-canned dashboard you could use? Well, we have your back on that one. Our <strong><a href="https://www.quickintelligence.co.uk/isa" target="_blank" rel="noopener noreferrer">Instant Sense Application</a></strong> can load any data-set and some metadata about those data and then presents it in a user-configurable dashboard. There is a short video of me presenting the application on YouTube, here: <a href="https://www.youtube.com/watch?v=jN3Vj93v9x4" target="_blank" rel="noopener noreferrer">https://www.youtube.com/watch?v=jN3Vj93v9x4</a>.</p>
<p>The application is driven by a spreadsheet which defines the fields to be used for dimensions (in filters, charts and tables) and also the measures to calculate over those dimensions.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505285" src="https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Session-Expressions.jpg" alt="Qlik Session Analyser Measures" width="701" height="247" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Session-Expressions-200x70.jpg 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Session-Expressions-300x106.jpg 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Session-Expressions-400x141.jpg 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Session-Expressions-600x211.jpg 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Session-Expressions.jpg 701w" sizes="(max-width: 701px) 100vw, 701px" /></p>
<p>If you already have the latest version of the <strong>Instant Sense Application</strong> you can simply download the zip file with the load script and metadata spreadsheet from here:</p>
<p><a href="https://www.quickintelligence.co.uk/SenseSessions.zip" target="_blank" rel="noopener noreferrer">https://www.quickintelligence.co.uk/SenseSessions.zip</a></p>
<p>If you have yet to download the app you can do so for free from here:</p>
<p><a href="https://www.quickintelligence.co.uk/isa" target="_blank" rel="noopener noreferrer">https://www.quickintelligence.co.uk/isa</a></p>
<p>Once you have downloaded the app you will need to upload it to your Sense server (via the QMC). At this point you can rename it to <strong>Sense Session Logs</strong> or similar. Open the app in your Work area and go to the <strong>data load editor</strong>. Now find the <strong>SenseSesssions</strong> folder under <strong>DataSets</strong> in the zip file. Open the load script text file and copy and paste the script over the script in the <strong>Main Data</strong> section of the load script. The <strong>SessionLogLookups.xlsx</strong> file needs to be copied to a folder you have a connection to in Sense, and then the past to that needs to be set in the variable on the <strong>Main</strong> sheet of the load script.</p>
<p>Once this has been done it should just be a case of reloading and you have your Sense Session Log Analyser.</p>
<p><img decoding="async" class="aligncenter size-full wp-image-1505290" src="https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Sense-Application-Stats.jpg" alt="Qlik Sense Application Stats" width="670" height="361" srcset="https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Sense-Application-Stats-200x108.jpg 200w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Sense-Application-Stats-300x162.jpg 300w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Sense-Application-Stats-400x216.jpg 400w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Sense-Application-Stats-600x323.jpg 600w, https://www.quickintelligence.co.uk/wp-content/uploads/2020/08/Qlik-Sense-Application-Stats.jpg 670w" sizes="(max-width: 670px) 100vw, 670px" /></p>
<p>There are a number of other example scripts included with the Instant Sense Application which you might like to explore. If you are interested in how the application was built, that is all explained in one of our <a href="https://www.quickintelligence.co.uk/instant-qlik-sense-application/">previous blog posts</a>.</p>
<p>If you have any comments or suggestions related to this post please post in the comments below.</p>
<p>The post <a href="https://www.quickintelligence.co.uk/sense-session-logs/">Analysing Sense Session Logs</a> appeared first on <a href="https://www.quickintelligence.co.uk"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.quickintelligence.co.uk/sense-session-logs/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1505281</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Minified using Disk

Served from: www.quickintelligence.co.uk @ 2026-07-11 11:19:59 by W3 Total Cache
-->