Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
ericpark
Partner - Contributor
Partner - Contributor

Qlikview Extension Sorting

Hi all,

I'm having troubles sorting my object extension by another dimension.

When i try and resort by dimension 2 for example i call:

_this.Layout.SetProperty('Chart.Dimension.2.Sort.PrimarySort.Use', '1', false);

_this.Layout.SetProperty('Chart.Dimension.2.Sort.PrimarySort', '4', true);

but nothing happens.

Is this the correct way to sort? If it is, why wouldn't these calls be working?

Thanks,

Eric

5 Replies
celindho
Partner - Creator
Partner - Creator

Hi,

Did you find an answer to your problem? I'm struggling with something very similar.

BR

-Christian

Not applicable

Hi Eric,

did you find an answer to your problem? I have unfortunately the same problem.


Regards

Heinz

Clever_Anjos
Employee
Employee

As long as I know you must set it into definition.xml and can´t do this dynamic (Maybe I´m wrong)

<Initiate Name="Chart.Dimension.0.Sort.ByNumeric.Use" value="0"/>

https://help.qlik.com/en-US/qlikview-developer/12.0/Subsystems/Extensions/Content/extensions-propert...

websy1985
Luminary Alumni
Luminary Alumni

Another option would be to sort the data client side. This is pretty straight forward in QlikView because the data comes as a multi-dimensional array. Something like this -

sortData(1, "asc);

function sortData(colIndex, order){
  var aWin = order=="asc"?1:-1;
  var bWin = aWin * -1;
  _this.Data.Rows.sort(function(a,b){
    if(a[colIndex].text > b[colIndex].text){
      return aWin;
    }
    else if (a[colIndex].text < b[colIndex].text) {
      return bWin;
    }
    else{
      return 0;
    }
  });
}

If you need to sort by more than 1 column then you'll need to expand on this logic.

I hope that helps.

Not applicable

Hello Nick,

thanks for your reply. Yes I know it´s possible to sort on the client side. But you have many rows to sort for example 50.000 and more it´s to much on the client side. I think the best way is to sort it by qlikview server and you get the sortet result set. I hope I find anyone a good solution.

Regards

Heinz