QlikView – How to Export the Full Data Model to Excel

February 22, 2019

Once you have a QlikView application built. Or someone else did it for you.

When you have a complex data model with a lot of related tables.

image

You would like to document it, and export all Tables / Fields + Data to Excel.

This is a script you will find on the QlikView help

image

Binary "c:\Application.qvw" ;

//Iterate through the loaded tables
For t = 0 to NoOfTables() - 1

//Iterate through the fields of table
 For f = 1 to NoOfFields(TableName($(t)))
  Tables:
  Load 
   TableName($(t)) as Table,
   TableNumber(TableName($(t))) as TableNo,
   NoOfRows(TableName($(t))) as TableRows,
   FieldName($(f),TableName($(t))) as Field, 
   FieldNumber(FieldName($(f),TableName($(t))),TableName($(t))) as FieldNo
   Autogenerate 1;
   
   let vTable = TableName($(t)));
    Store $(vTable) into d:\Temp\$(vTable).csv](txt);
 Next f
Next t;

But the downside is that is will export ALL FIELDS and ALL DATA.

But some table will hold millions of records, so this is a bit over the top.

image

 

Solution :

Use this script to Export MAX X number of records

Binary "C:\Your Application.qvw" ;

// Export number of Rows
let vRows = 1000;

//Iterate through the fields of table
let vtables = NoOfTables();

for i=0 to $(vtables)-1

let vTable = TableName($(i));

// STORE $(vTable) into C:\Temp\Export\$(vTable).csv (txt,delimiter is '|');

ReducedTable:

LOAD *, RowNo()

RESIDENT $(vTable) where RowNo() < $(vRows) ;

	STORE ReducedTable into d:\Temp\Export\$(vTable).csv (txt,delimiter is '|');

DROP Table ReducedTable;

Sleep 500;

NEXT

So you end up with the full data model tables and samples data in Excel

image

Enjoy !

Advertisements

QlikView – How to get MS Azure – Office365 BI Reports

February 3, 2016

QlikView Desktop is one of the leading BI In Memory Visualization Tools.

As I have shown in previous posts, this contains a VBScript host engine. And as well the Desktop Client is fully COM Compatible.

Giving these 2 nice bonus points for us scripters Smile

Let see how to use QlikView to provide BI Insights in your MS Azure and Office365 environment.

In the Office365 Admin portal, you can get nice statistics to analyze issues and performance if needed.

image

But QlikView can serve you better ! Because it is all centralized in your dashboard that is fully customizable Winking smile

image

Since it is all in memory, it is lightning fast to do your analysis. If you schedule the QVW you have it all ready each morning.

I built this proof of concept, and will be gradually ad more statistics.

See here for more info on Office365 Reporting web service

Happy Scripting !


QlikView – Access Data from SSRS

March 3, 2015

Since QlikView can’t access certain data sources like MS Analysis Services (SSAS) or other exotic data sources (SAP NetWeaver BI, Hyperion, TERADATA) natively.

We can fall back on the perfect middleware for this being MS SQL Reporting services

image

The approach is a simple as can be. Setup an SSRS server (can even be the MS SQL Express (Free) Edition & SSRS add-on)

The SSRS report server has natively a web service interface, exposing a SOAP and URL Interface.

Next develop your SSRS reports (which can handle multi data sources in 1 report Smile)

image

Like for example a SharePoint List combined with an Oracle database, or anything else.

Simular to PowerPivot that can access an SSRS Data Source. We can do the same with QlikView.

Use a Web File connection as Data Source

image

Fill in your report URL link and add the rs:Format=XML parameter to get an XML output from you report

image

If all goes well you will get the Report XML output and see the SSRS TABLIX and FIELDS Smile

image

That’s it, now you are ready to build your QlikView GUI

Once you know this technique you can as well use this to access an SSRS in the MS Azure cloud.Winking smile

Enjoy!


QlikView – A BI Reporting Tool for MS SQL CE

October 6, 2014

There are numerous tools on the net which will help you to access a MS SQL CE  database.

Even PowerShell can do the job, but it is not the same as have a full blown BI Reporting Tool under you fingertips.

So let’s look at QlikView to be able to access the .sdf database.

I used the Northwind.sdf example database

When creating a new report you need to select the data source for a Compact Ed. Database.

But as you can see it it not available in the list Sad smile

image

No worries.

Just type in the connection string yourself like this.

OLEDB CONNECT32 TO [Provider=Microsoft.SQLSERVER.CE.OLEDB.4.0;Data Source=”C:\Northwind.sdf”];

and complete with the SQL statement

Customers:
LOAD *;
SQL SELECT * FROM Customers;

Orders:
LOAD *;
SQL SELECT [Order ID],LOWER(Freight) as Freight, [Customer ID] FROM Orders;

image

Refresh and you are done.

PS: If it does not work make sure you have installed the MS SQL CE framework in your PC.

Enjoy!


QlikView – How to run MDX queries against OLAP Cubes

September 29, 2014

QlikView does not support natively accessing OLAP Cubes running MDX Queries.

But with a little creativity you can get it going.

1. First of all I setup an IcCube OLAP In Memory Cube to run the MDX against in the IDE.

image

IcCube supports the XML/A protocol natively Smile

Of course you can use your existing SSAS cube(s) as well as a data source, if you have setup an XML/A endpoint config.

I just used IcCube to get a quick testing environment.

2. Next I have used MS SQL as a middleware to grab the OLAP Cube data.

This MS SQL Express (Free) Edition is just there to connect to from the QV client.

3. On the QV client I made an ODBC connection to the MS SQL Express.

Next I run the OPENROWSET Query against the OLAP Cube using XML/A protocol.

image

As you can see the OPENROWSET command is executed locally on the MS SQL Server.

See : DATA SOURCE=http://localhost:8282/icCube/xmla?msrs

This makes it super easy to access the CUBE data.

Put in there your MDX Query and go.

4. When finished, reload and and look at the result.

image

This is realy fun stuff you don’t learn at school Winking smile

Enjoy !


QlikView – Creating Macro’s using VBScript

September 29, 2014

Qlikview is heaven for scripters like us Smile

It has an API that can be accessed by any COM compatible client.

And on the other hand it supports the VBScript language for writing Macro’s.

This will get you started.

First add the Macro to QV => Tools -> EDIT Module

image

Go to => Settings -> Document Properties -> Triggers

clip_image002

Add your Macro Function

clip_image004

Open the document again and test it.

clip_image006

See help file to know where you can trigger macro’s. There are several objects to which you can attach Macros

This is a Button example

clip_image008

clip_image010

Now it’s up to your imagination what you are going to automate in QlikView.

We could also call PowerShell scripts if you like.

If you are interested stay tuned Winking smile


QlikView – How to Consume a WebService

July 30, 2014

First get the proper webservice URL.

Example: http://wsf.cdyne.com/WeatherWS/Weather.asmx/GetCityForecastByZIP?ZIP=33139

Open QV go the the Script and press the button WebFile.

Paste your WebService URL

image

Select the fields you want

image

And add them to an Object

image

It’s not getting hot today Sad smile