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: 
Anonymous
Not applicable

Qlik Sense example of using Sort By Expression?

Hi there

I am attempting to create a listbox extension that will display the values of a dimension sorted by the count of a measure in descending order. I'm using the latest version of Qlik Sense Desktop to develop it. It looks like the 'sort by expression' option should allow me to do this so I followed the Qlik Help documentation (using qSortByExpression and qExpression) but it is not working for me.

When I add the extension to an app in Edit mode and edit the sort settings - I get errors in Chrome Dev Tools as soon as I choose to sort by Expression. If I continue to edit the sort settings and enter an expression to sort by (=Count([Fund ID]) it doesn't save when I click 'Done'. If I click on Edit again the expression box is empty and the errors continue to be displayed in Dev Tools.

The error is: TypeError: Cannot read property 'qExpr' of undefined

In google I can only find Qlik View examples or am redirected to the Qlik Help documentation.

Has anyone got an example of this sort by expression in use in Qlik Sense?

properties file snippet:

settings: {

uses: "settings",

items: {

SortListbox: {

type: "items",

label: "Sort Settings",

items: {

SortSettings: {

ref:"props.sortSettings",

translation:"Sort Criteria",

type:"numeric",

component:"dropdown",

options:[

{ value: 0, label: "Logical State" },

{ value: 1, label: "Numeric Value" },

{ value: 2, label: "Alphabetical Order" },

{ value: 3, label: "Initial Load Order" },

{ value: 4, label: "Expression" }

],

defaultValue:4

},

qSortByState:{...},

qSortByNumeric:{...},

qSortByAscii:{...},

qSortByLoadOrder:{...},

qSortByExpression:{

ref:"qListObjectDef.qDef.qSortCriterias.0.qSortByExpression",

translation:"Sort by Expression",

type:"numeric",

component:"dropdown",

options:[

{ value:1, label:"Ascending" },

{ value:0, label:"None" },

{ value:-1, label:"Descending" }

],

defaultValue:0,

show: function(data) { return data.props.sortSettings == 4; }

},

qExpression:{

ref:"qListObjectDef.qDef.qSortCriterias.0.qExpression",

translation:"Expression",

type:"string",

expression:"always",

expressionType: "dimension",

defaultValue:"",

show: function(data) { return data.props.sortSettings == 4; }

} } },

error example:

TypeError: Cannot read property 'qExpr' of undefined

    at o.get (client.js??1502824274034:43)

    at fn (eval at compile (require.js?1502824274034:21), <anonymous>:4:82)

    at require.js?1502824274034:22

    at o.$digest (require.js?1502824274034:20)

    at o.$apply (require.js?1502824274034:20)

    at Object.$apply (require.js?1502824274034:38)

    at client.js??1502824274034:33

TypeError: Cannot read property 'qExpr' of undefined

    at o.a.isLocked (client.js??1502824274034:43)

    at Array.fn3 (eval at compile (require.js?1502824274034:21), <anonymous>:4:1103)

    at require.js?1502824274034:20

    at o.$digest (require.js?1502824274034:20)

    at o.$apply (require.js?1502824274034:20)

    at Object.$apply (require.js?1502824274034:38)

    at client.js??1502824274034:33

Thanks

0 Replies