Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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

Labels (1)
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 !