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

Sorting in Charts

Hi All,

In my application  all the charts for sorting am using  the below approach, where I have to sort values of a chart in following order

‘Others’ should be in the last always.

123.JPG

What I have done here is I have assigned each and every column with a rank no and in sorting properties used conditional sorting for “only(rank)”.

LOAD * INLINE [
    LOC CODE, RANK
    CLD, 1
    CTC, 2
    ODD, 3
    SDC, 4
    Plant, 5
    Other, 6
]
;

But this is causing more inline tables getting created inTable Viewer.   whether this is correct way to perform this sorting or is there any other better way. Sorting is to be implemented in almost every chart in my application,So please help me this....

Regards,

Anil

1 Solution

Accepted Solutions
Not applicable
Author

Vijay now its working perfectly....i have changed a bit in the exp like this

If([LOC CODE] ='CLD', 1,(If( [LOC CODE] ='CTC', 2,(If( [LOC CODE] ='ODD', 3,(If( [LOC CODE] ='SDC', 4,(If( [LOC CODE] ='Plant',5,(If( [LOC CODE] ='Other',6)))))))))))

Sridhar i confused a bit with your answer but it is working from you way also

i think above exp is the easy to use for sorting what do you say guys.........

Guys thanx for all your replies and suggestions.......

Regards,

Anil

View solution in original post

12 Replies
vijay_iitkgp
Partner - Specialist
Partner - Specialist

Hi ,

You can use sorting by expression and use if([LOC CODE]='CLD',1,If(........)

Hope this will help you.

Regards

VIjay

sridhar240784
Creator III
Creator III

Hi,

One more option would be loading this inlinen table as mapping table and use Apply Map() function & Dual function to sort your chart. So that you`ll not see many inline tables in table viewer.

Check the attached application.

Hope this helps you.

-Sridhar

rohit214
Creator III
Creator III

hi

try this

if(pick(match([LOC CODE] ,'CLD', 'CTC', 'ODD' ,'SDC', 'Plant','Other'),'1','2','3','4','5','6')

thanks &regards

rohit

 

jagan
Luminary Alumni
Luminary Alumni

Hi Anil,

Instead of using =only(RANK) try using RANK in Expression section and select Ascending or descending.  I usually do like this.  It works.

Regards,

Jagan.

Not applicable
Author

Thanks for you replies guys......

@ Jagan: here the problem is i want to avoid inline tables

@Rohit: Your expression is giving error this exp am directly using in sort expression

@Srdiahr: From your option any way inline tables getting created in table viewer.

@Vijay: i have tried you expresssion its also giving error could yyou please give me full exp.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try putting the Inline table in the last tab.  I also faced the same and moved the inline code to end of the script.

Hope this helps you.

Regards,

Jagan.

vijay_iitkgp
Partner - Specialist
Partner - Specialist

Hi,

In sort expression you can write

If( LOC CODE ='CLD', 1,

If( LOC CODE ='CTC, 2,

If( LOC CODE ='ODD, 3,

If( LOC CODE ='SDC, 4,

If( LOC CODE ='Plant,5,

If( LOC CODE ='Other,6))))))

And sort it in ascending order.

Regards

VIjay

sridhar240784
Creator III
Creator III

Hi,

If you use a Mapping load, table will not be shown in table viewer.

Below is the explaination copied from QV Help.

"The mapping prefix to a Load or Select statement is used for mapping a certain field value or expression to the values in the first column of the mapping table. A mapping table consists of two columns, the fist containing comparison values and the second containing the desired mapping values. Mapping tables will be stored temporarily in the memory and dropped automatically, after script execution."

-Sridhar

Not applicable
Author

Hi,

   

    @Jagan: if we move inline code to last tab any way tables are getting created am i right?

    @ Vijay: still showing error in expression look into the below screen shot

    @Sridhar: I have tried you approach its working correctly and this is ok for limited records but if we have 100-1000 records in that case how to do????

sort.JPG

If am wrong please correct me

Regards,

Anil