Nice Read/Watch: QlikView Scalability Videos

Recently there have been posted some really nice and interesting vidos on Scalability with QlikView on YouTube:

QlikView Scalability – Video 1: Overview

“This video introduces the 5 part video series and provides a high-level overview of the topics associated with understanding how QlikView can scale.”

YouTube Preview Image

QlikView Scalability – Video 2: System Resource Usage

“This video provides a fundamental understanding of how QlikView utilizes system resources such as RAM and CPU in a typical deployment.”

YouTube Preview Image

QlikView Scalability – Video 3: Scaling by Data

“This video covers the topic of scaling QlikView deployments when facing increasing data volumes.”

YouTube Preview Image

QlikView Scalability – Video 4: Scaling by Users

“This video covers the topic of scaling QlikView deployments when facing increasing user numbers.”

YouTube Preview Image

QlikView Scalability – Video 5: Scaling by Application Design

“This video covers the topics of understanding QlikView’s approach to scaling the number of applications in a deployment and discusses the importance of application design as it relates to QlikView performance.”

YouTube Preview Image
Bookmark and Share

Tags:

Nice read: How to use Git with QlikView

Peter Magnusson (the author behind blog.birchroad.net) has posted a really nice explanation on how QlikView and Git can work together ….

http://blog.birchroad.net/2011/03/16/how-to-use-git-with-qlikview-10/

http://birchroad.wordpress.com/2011/03/16/how-to-use-git-with-qlikview-10/

For all who are working with Git this is really worth reading …!



Bookmark and Share

Tags: ,

QlikChallenge #1: Getting the max value over multiple expressions

Some days ago I received a funny/tricky question:

Let’s assume you have the following data:

And you want to calculate the highest expression of Value_1, Value_2, etc. within your load script to get the following result:

How would you solve this?
Just use the comment section to post your ideas … I am looking forward to reviewing your solutions … :)

Regards
Stefan

P.S.: Ralph & Team: You are not allowed to participate in this competition because you have already received my solution for that question :)

Bookmark and Share

QlikTip #32: Exporting multiple QV objects to a single Excel document

QlikView supports exporting any object’s content to Excel out of the box. But if you need to export multiple objects to one Excel document you have write some macro code.

This is sometimes pain and time-consuming. Therefore I have created a code which can be easily re-used and where you only have to declare which objects should be exported and the rest will be done automatically.

The scenario

Let’s assume we have a QlikView application with some objects:

image

Now let’s have a look how we can cover the following scenarios. In all cases I am first declaring some settings (as a VBScript array) which will be passed to the function copyObjectsToExcelSheet.

(The sample application and the source code can be downloaded at the end of this article)

The idea behind this solution

My idea was to create a functionality which can be used in most of the required scenarios:

  • Adding multiple objects to a single sheet
  • Adding multiple objects to multiple sheets
  • Define a name of each sheet in Excel (instead of just using “Sheet1″, “Sheet2″, etc.)
  • Exporting either the data of an object or exporting the object/chart as an image

Therefore we first have to create an “export definition” by using a multidimensional array in VBScript:

Dim aryExport(0,3)

Definition of the four dimensions within the array:

Index Description
0 Id of the QlikView object to copy from
1 Name of the sheet (in Excel) where the object should be copied to

(If a sheet with the same name already exists no new sheet will be created, instead the existing sheet will be used for pasting the object)
Note: the sheetName can be max 31 characters long
2 Range in Excel where the object should be pasted to
3 Copy & Paste Mode ["data", "image"]
Defines if the objects underlaying data should be pasted (“data”) or the the image representing the object should be used

Sample 1: Exporting just one object and defining a name for the sheet

'// Array for export definitions
Dim aryExport(0,3)

aryExport(0,0) = "objSalesPerYearAndRegion"
aryExport(0,1) = "Sales per Region a. Year"
aryExport(0,2) = "A1"
aryExport(0,3) = "data"

Dim objExcelWorkbook 'as Excel.Workbook
Set objExcelWorkbook = copyObjectsToExcelSheet(ActiveDocument, aryExport)

'// Now either just leave Excel open or do some other stuff here
'// like saving the excel, some formatting stuff, ...

This will result into:

Exporting just one object and defining a name for the sheet

OK, OK, not really the big effort so far :) But let’s have a look at further requirements …

Sample 2: More enhanced export of three objects to three different sheets

Now let’s export three different objects to three different sheets within the same Excel document:

'// Array for export definitions
Dim aryExport(2,3)

aryExport(0,0) = "objSalesPerRegion"
aryExport(0,1) = "Sales per Region"
aryExport(0,2) = "A1"
aryExport(0,3) = "data"

aryExport(1,0) = "objTopCustomers"
aryExport(1,1) = "Top Customers"
aryExport(1,2) = "A1"
aryExport(1,3) = "data"

aryExport(2,0) = "objSalesPerYearAndRegion"
aryExport(2,1) = "Sales per Region a. Year"
aryExport(2,2) = "A1"
aryExport(2,3) = "data"

Dim objExcelWorkbook 'as Excel.Workbook
Set objExcelWorkbook = copyObjectsToExcelSheet(ActiveDocument, aryExport)

'// Now either just leave Excel open or do some other stuff here
'// like saving the excel, some formatting stuff, ...

Now the result is more interesting:

Exporting three QlikView objects to a single Excel document with three worksheets

Sample 3: Export of multiple objects in different formats (data & image)

But now let’s try the get most out of the script:

'// ****************************************************************
'// Export of multiple objects in different formats (data & image)
'// In one case (sheet "Sales Overview") two objects are placed on
'// one sheet.
'// ****************************************************************
Dim aryExport(4,3)

aryExport(0,0) = "objSalesPerRegion"
aryExport(0,1) = "Sales Overview"
aryExport(0,2) = "A1"
aryExport(0,3) = "image"

aryExport(1,0) = "objTopCustomers"
aryExport(1,1) = "Sales Overview"
aryExport(1,2) = "H1"
aryExport(1,3) = "image"

aryExport(2,0) = "objSalesPerYearAndRegion"
aryExport(2,1) = "Sales Overview"
aryExport(2,2) = "A14"
aryExport(2,3) = "data"

aryExport(3,0) = "objTopCustomers"
aryExport(3,1) = "Top Customers"
aryExport(3,2) = "A1"
aryExport(3,3) = "image"

aryExport(4,0) = "objTopCustomers"
aryExport(4,1) = "Top Customers"
aryExport(4,2) = "A14"
aryExport(4,3) = "data"

Dim objExcelWorkbook 'as Excel.Workbook
Set objExcelWorkbook = copyObjectsToExcelSheet(ActiveDocument, aryExport)

'// Now either just leave Excel open or do some other stuff here
'// like saving the excel, some formatting stuff, ...

The result:

The resulting sheet 1 containing images and a data table

The resulting sheet 2 containing images and a data table

As always, I’ll be happy if you’d share your thoughts, ideas, comments, improvements with me!

Download Source Files:

Exporting multiple QlikView objects to a single Excel document (1.087 KB)
(2011/03/15: Updated version v1.02 with some minor bugfixes)




Bookmark and Share

Tags: , ,

Visual Studio 2010 SP1 is available (fixes the OCX bug)

Some days ago the Service Pack 1 for Visual Studio 2010 has been published.

This also fixes the Visual Studio bug when trying to add the QlikView OCX control which is also described in the Reference Manual of QlikView:


Screenshot from the QlikView Reference Manual

I have just tested this and registration of OCX now works again as expected.

Bookmark and Share

Tags: , ,

QlikTip #30: How to delete existing QVD files via load-script

In some delta-load scenarios it may be necessary to delete specific QVD files from within your load-script (QVD-Generator).

Imagine we have the following situation:

There is a delta-load which is loading the newest data from our database every day. Most days we only have to make an incremental load (“I”), but sometimes the database is refilled, so on these days we have to rebuild our QVD-storage completely. Therefore also previously loaded QVD-files should not be considered anymore):

Loading plan of the delta-load

Loading plan of the delta-load

So on 01.01.2011 and 04.01.2011 we have to make our full-load, all data within QVD-files on disk which a lower LoadNr than the current one should not be considered anymore …

Three different approaches:

When thinking about this requirement I have three ideas how to accomplish that:

  1. Delete the files with a macro called from the load script
  2. Delete the files by executing a batch statement
  3. Use a pure load-script statement without giving your script system-access and empty the QVD-files within your load-statement

(Continue to read to approach 3 because I’d recommend doing it this way! :) )

Var. 1) Delete the files with a macro

The idea is simple:

  • Create a macro using the COM-object “Scrpting.FileSystemObject”
  • Call this macro from within your load-script

Macro:

public function DeleteFile(filePath)

	Set objFSO = CreateObject("Scripting.FileSystemObject")
	Dim retVal 'as Boolean

	If objFSO.FileExists(filePath) Then
		Call objFSO.DeleteFile(filePath)
		retVal = true
	Else
		Set objFSO = nothing
		retVal = false
	End If 

	DeleteFile = retVal

end function

Load-Script:

SET vQvdFile = 'Sales_2011_01.qvd';
LET fileDeleted = (DeleteFile('$(vQvdFile)') = -1);

// 0 = false
// 1 = true
TRACE File deleted $(fileDeleted);

To get this to work you have to lower the security-level of macro-execution and allow “System Access”:

Allow System Access for your Macro

Cons:

  • You have to use macros
  • You have to lower the security-level
  • More complex to use

Var. 2) Delete the files by executing a batch statement

Just add the following line of codes to your load-script:

EXECUTE cmd.exe /C del Sales_2011_01.qvd;

For getting this to work you have to enable the following option:

Allow your load-script to execute external programs

Pros:

  • If you are already allowing external programs to be executed from your load-script, this is probably the easiest way!!!

Cons:

  • You have to lower the security-level

Var 3) Just empty the QVD files

Surprise, surprise, this is my favorite approach:

// ******************************************************************
// EmptyQvd is a generic procedure which deletes all records within a
// given QVD file.
// This is especially usefull if you do not need the records within
// this file anymore but do not want to rely on macros/batch-commands
// to delete the file.
// The fields will remain within the QVD file so you will not have any
// problems doing a wildcard load like "LOAD * FROM 'QVD_*.qvd'" ...
//
// ~~
// Usage:
// Call EmptyQvd('Sales_2009_02.qvd') // using a relative path
// or
// Call EmptyQvd('C:\QlikView\Sales_2009_02.qvd') // using an absolute path
//
// ~
// Author: Stefan Walther
// Date: 01/31/2011
// Version 1.0
// ******************************************************************
Sub EmptyQvd(qvdFilePath)

TRACE --;
TRACE Start EmptyQvd for file $(qvdFilePath);

// First check if the qvd-file exists
if (not IsNull(QvdCreateTime(qvdFilePath))) then
	TRACE ... file exists ...;

	// Check if the Qvd-file contains more than 0 records
	if(QvdNoOfRecords(qvdFilePath) > 0) then

		// Get one of the fields to create the fake "WHERE EXISTS" clause
		LET vFieldName = QvdFieldName(qvdFilePath,1);		

		// Now let's create a random value which cannot exist within
		// the first field
		FakeFieldTable:
		LOAD
			// Create a fake-field which can never be found within
			// the existing qvd
			'FakeField' & 'ABCDEFGHIJKLMNOPQRSTWXYZ' &
			text(round(rand())) as $(vFieldName)
		AutoGenerate(1);

		// Create a random table name to prevent collisions with already
		// existing tables in memory
		LET vTempTableName = '_TempTableName' &
			text(round(rand() * pow(9,10)));

		// Load the existing QVD-file with and EXISTS clause which cannot
		// be found within the QVD-file; so the result will be an empty
		// inline table with all field definitions of the QVD-file
		$(vTempTableName):
		LOAD
			*,
			1 as loadEnabler
		FROM '$(qvdFilePath)' (qvd)
		WHERE Exists(Dim1)
		;

		// Re-Store the QVD-file, just with the field definitions but
		// without any data ...
		STORE $(vTempTableName) INTO $(qvdFilePath) (qvd);
		DROP TABLE $(vTempTableName);

		DROP TABLE FakeFieldTable;

	end if

else
	TRACE ... file '$(qvdFilePath)' does not exist;

end if

TRACE finished EmptyQvd;
TRACE --;

End Sub
// __________________________________________________________________

Call the script within your load-script:

Call emptyQvd('.\Sales_2011_10.qvd');
If a = 0 then
	TRACE ... TEST SUCCEEDED: QVD file has 0 records ...;
Else
	TRACE ... TEST FAILED: QVD file has $(a) records ...
End if

Pros:

  • Doing so you will not have to change the required security level for executing your load-statement
  • But most important: this will not break scenarios with a wildcard load from QVDs (like “LOAD * FROM ‘Sales_*.qvd (qvd)’;”

Cons:

  • Sure the file will still remain on your hard disk …
Bookmark and Share

Tags: , , , ,