Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create a pivot with rows and columns in script

Hi,

from an empty PIVOT chart, i'm adding dimensions and expressions with a script through functions like that :

chart.AddDimension

chart.AddExpression

but how can i say that i want the dimensions to be seen on rows or colums ?

the user can drag the rows into columns  but is it possible to do it in design time ?

Thanks

1 Solution

Accepted Solutions
danielrozental
Master II
Master II

Check property NumberOfLeftDimensions

Sample from APIGUIDE

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.Item(0).SortCriteria.SortByAscii=0

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

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

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

Prop.TableProperties.NumberOfLeftDimensions = 1

Hlo.SetProperties Prop

View solution in original post

2 Replies
danielrozental
Master II
Master II

Check property NumberOfLeftDimensions

Sample from APIGUIDE

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.Item(0).SortCriteria.SortByAscii=0

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

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

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

Prop.TableProperties.NumberOfLeftDimensions = 1

Hlo.SetProperties Prop

Not applicable
Author

Excellent, thank you !