Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Not applicable

Dual Function not working

I'm not sure how to use this function. The examples I've seen seem to focus on dates and such and not really fields with good examples. I'm using qlik sense and have data coming in. I want to take the dimension I'm using and sort based on the text in a bar chart but for some reason the sort isn't working and someone suggested using the dual function.

Here is the data I'm loading:




     Pick(WildMatch(GroupItem, '*Arcadia*','*Airman*'),'Other', GroupItem) as NewNonCustomer;



     SubField(NonCustomer, ',') as GroupItem;

The data loads and I pull in the dimension to the chart, GroupItem and the measure, GroupItem(Count). When the chart displays, I get the correct data but the data does not sort alphabetically even though qlik sense says it is. The data displays as follows:






Someone suggested using the dual function but that doesn't seem to work.

3 Replies
Esteemed Contributor II

Re: Dual Function not working

can you post a sample app?


Re: Dual Function not working

Where and how is Dual () being used? Sample will help.

Honored Contributor II

Re: Dual Function not working

As kind of one-off you may enter an expression into the sort-properties of an object:

MATCH(Customer, 'USGhee', 'Airman', 'Chordia', ......)

would sort the customer in the order of the Match, i.e. USGhee first, then Airman etc ...

When you wish to reuse this kind of order, you may load the sortorder (from extern, or as INLINE):

MapSort: MAPPING LOAD * INLINE [Customer, SortOrder

USGhee, 1

Airman, 2

Chordia, 3


When you load your data, you may add the DUAL-function:

Data: LOAD *, DUAL(Customer, APPLYMAP('mapSort', Customer))          AS Customer_ord

FROM ....;

With this a number would be attached to the customer. In Tables etc this field will behave like a number (sorting, rightbound etc.).