Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create Pivot Table in VB macro

- Is it possible to create a Pivot Table from a VB macro ? I would like to have a macro (script created with Edit Module) to create a new QLikView pivot table in an existing document: select fields from the QLikView document, sort values, add fields and fill values for these new fields according to some rules.

- Could you hint at some example script to create QLikView object, in particular create a pivot Table ?

Thanks in advance.

13 Replies
whiteline
Master II
Master II

Hi.

Use the API Guide. There are simple examples of creating objects.

QlikView Core COM API Guide - Version 11

Not applicable
Author

thanks. i cnanot open. is there a pdf version ? thanks

whiteline
Master II
Master II

You have your own local copy of QV documentation somewhere:

C:\ProgramData\QlikTech\QlikView Documentation\Reference Manual

rem Create HLO system table on new sheet

set Sheet=ActiveDocument.CreateSheet

set Hlo=Sheet.CreatePivotTable

Hlo.AddDimension "$Field"

Hlo.AddDimension "$Table"

Hlo.AddExpression "Only([$Field])"

set Prop = Hlo.GetProperties

Prop.TableProperties.PivotAlwaysFullyExpanded=true

Prop.Dimensions(0).SortCriteria.SortByAscii=0

Prop.Dimensions(0).SortCriteria.SortByLoadOrder=1

Prop.Dimensions(1).SortCriteria.SortByAscii=0

Prop.Dimensions(1).SortCriteria.SortByLoadOrder=1

Prop.TableProperties.NumberOfLeftDimensions=1

Hlo.SetProperties Prop

Not applicable
Author

there seems to be not much specific about creation of new sheet object in the help file. Could someone hint at a more precise documentation?

whiteline
Master II
Master II

You have structured API documentation with examples in APIguide.qvw

There is nothing more precise.

Not applicable
Author

Is there nothing more in the .qvw than the automation chapter in the Reference saved on disk in ProgramData?

whiteline
Master II
Master II

Yes. Object model definition and  VB code examples. Have you found the APIGuide.qvw ?

Not applicable
Author

I cannot access this document with PE.

ashfaq_haseeb
Champion III
Champion III

Hi,

If you have Qlikview Installed,

you can find the API guide in below path.

C:\ProgramData\QlikTech\QlikView Documentation\Automation\APIguide.qvw

Regards

ASHFAQ