Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

alicebotteri
New Contributor II

Filter with sort a default value

Hi guys,

I need a filter with sorting properties and default value.

I downloaded the bi-era list box with default value but I don't find anything reguarding the sorting.

Thanks

Alice

Tags (1)
15 Replies
agigliotti
Honored Contributor II

Re: Filter with sort a default value

Hi Alice,

I suggest you to sort the field within your script

or take a look at Aggr function with sorting crtieria http://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/ChartFunctions/aggr.htm#Sorting

shraddha_g
Honored Contributor III

Re: Filter with sort a default value

alicebotteri
New Contributor II

Re: Filter with sort a default value

It's fine but I initial selection doesnt'work I have  a field and I write Category='Total' and it doesn't work. Where am I wrong ?

MVP
MVP

Re: Filter with sort a default value

Hi Alice,

The best way to get a specific sort order on a Filter Pane is to use a dual data type.  These have both a numeric and a string representation.  This means you can have a different sort order to the alphabetic one.

So, to have a filter that sorts the words one to four correctly it would be:

Map_Number:

MAPPING LOAD

  Name,Num

INLINE [

Name,Num

One,1

Two,2

Three,3

Four,4

];

Table:

LOAD

  Dual(Number, ApplyMap('Map_Number', Number, 99)) as Number

INLINE [

Number

Four

One

Three

Two

];

You will see that a filter pane based on this will sort correctly.

There is no "only one selected" or triggers in Qlik Sense (as there was in QlikView) so an elegant way to solve the default issue is to use Set Analysis in expressions.

First you would need to create a variable that returns the first sorted value (this can then be used in legends also).  In this example the name would be vFirstValue and the code:

=minstring({<Number={"=$(=min(Number))"}>}Number)

The code is a little convoluted, but basically you are finding the lowest numeric value and then find the string equivalent that goes with it.

You can then use this expression in Set Analysis expressions, so regardless of what is selected only the first sorted value is used in the expression:

=sum({<Number={'$(vFirstValue)'}>}Number)


Hope this all makes some kind of sense?

I've attached a QVF in the hope this makes things a bit clearer.

Steve

shraddha_g
Honored Contributor III

Re: Filter with sort a default value

Is it perfectly matching with value in category Field.

Try giving input without using ' (Single Quotes).

kumarnatarajan
Valued Contributor

Re: Filter with sort a default value

Hi Alice,

You can follow as Steve suggested,

Else find the below link to download the updated extension file. It contains sorting options.

https://drive.google.com/open?id=0B7mtxGtlcr4QZDhkaEJFRUFEVEU

Regards,

Kumar

MVP
MVP

Re: Filter with sort a default value

Hi Kumar,

Are these changes getting forked back into the GitHub repo that fredberg‌ is maintaining? Or is this essentially a new extension?

The Drive link currently requires access to be granted.  Could a public link be posted, or could it be uploaded elsewhere?

kumarnatarajan
Valued Contributor

Re: Filter with sort a default value

No Steve,

The versions, I am not maintaining GitHub account.

I have given the access, now we can download from drive.

agigliotti
Honored Contributor II

Re: Filter with sort a default value

to unzip it a password is needed.

could you provide it?

Community Browser