Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Changing column order

Hi everyone.

I have a straight table with columns from the dimensions tab as well as the expressions tab. There is one column at the end (dimension column) that will not move to a different position when I drag it. I played around by adding other dimensions after it and they too refuse to move.

Please help / advise.

Thank you.

Regards,

Ashley.

15 Replies
dgreenberg
Luminary Alumni
Luminary Alumni

Never mind figured it out

set chart = ActiveDocument.getsheetobject("CH1112")

    set cp = chart.GetProperties

need to be at the top of the macro not in the middle.

Not applicable
Author

Hi all

if you use straight table you have flexibility to mix the dimension and expression Oder,

for example if you have the flowing  table with

Region,OrderID as dimensions, 

QTY, Amount,Discount as expression

RegionOrderIDQTYAmountDiscount

you can drag them to be like

RegionQTYAmountOrderIDDiscount

hope it helpful for you,

Regards

reanfadyl
Partner - Creator
Partner - Creator

Bump... just in case someone is feeling lazy. Worked a treat, thanks all.

sub fixtablesort

set chart = ActiveDocument.getsheetobject("CH336")

set cp = chart.GetProperties

'get the current sort order

d = cp.TableProperties.DisplayOrder

for i = lbound(d) to ubound(d)

msgbox d(i)

next

    cp.TableProperties.DisplayOrder = 1

    chart.setproperties cp

'get the new sort order

d = cp.TableProperties.DisplayOrder

for i = lbound(d) to ubound(d)

msgbox d(i)

next

end sub

kwarren1
Partner - Contributor III
Partner - Contributor III

Thanks! I just spent 30 min. trying to find a solution to my straight table ordering issues with expressions among dimensions that would not move order until your simple suggestion of dragging and dropping worked like a charm!

jwaligora
Creator II
Creator II

I'm on April 2020 SR4. It's been almost 10 years since this issue got posted, and I'm still running into this problem. As noted in earlier comments, drag/drop doesn't work in my case even after unhiding all the columns.  Being stuck on a such a seemingly simple step is immensely frustrating, not to mention extremely difficult to explain to management.

greenee
Contributor III
Contributor III

Hi All, 
I know it's been a while, but thought I would add this. 

I had the same issue and have found a possible solution using the files in the -prj folder. 

Create a folder in the same directory as your .qvw file called the same as the qvw, but with -prj as the name of the folder. in this example I created this folder Dimension order 2-prj  . 
When you save the file  Dimension order 2.qvw, it will populate the -prj folder with many files. 
Your example file with the problem table, the chart id was CH1112. 
Open the CH1112.xml file in the -prj folder and search for <DisplayOrder> 
Your original was like this
<DisplayOrder>
<int>3</int>
<int>18</int>
<int>1</int>
</DisplayOrder>

This means that the chart will show the 1st 3 dims, then 18 Expressions, then 1 other Dim.

I deleted the 3rd line and changed the 1st line to be 4, (for 4 Dims) 
Like this:
<DisplayOrder>
<int>4</int>
<int>18</int>
</DisplayOrder>
Then save the file and close it.

Close you application and reopen it.  When the app opens it checks to see if there is a -prj folder and if so, takes the settings from this folder for the app.
(Thanks Rob Wunderlich for the pointer using your Cookbook site)

The table now has the right sort order for the Dims and Expressions 🙂

greenee_1-1717752923065.png

 

Hope this helps, as its taken me a few days to figure this out also with the help of the macro post above, I got to know what the numbers actually meant in the pop up box.  

Even by dragging and dropping, disabling and re-enabling expressions and Dims, the error can persist on access point. 

Regards
greenee