Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Sort with expression trouble

I have a list box with an expression to list only certain field names.  I want that list to stay static (not resorted when selection is made).  I'm using the sort expression with the following formula:

=if(Market_Data.Scenario='Actual',1,

if(Market_Data.Scenario=$(vCurLBEScenario),2,

if(Market_Data.Scenario=$(vPrevLBEScenario),3,

if(Market_Data.Scenario='Plan-16B',4,

if(Market_Data.Scenario='Standard-16',5,

if(Market_Data.Scenario='LBE_Feb',6,

if(Market_Data.Scenario='LBE_May',7,

if(Market_Data.Scenario='LBE_Aug',8,

if(Market_Data.Scenario='LBE_Nov',9)))))))))

If nothing is selected the order is acroding to this formula.  Once a selection is made the order changes.  I dont want that.  I do not have any other sort method selected.

1 Solution

Accepted Solutions
sunny_talwar

May be this:

=if(Only({1} Market_Data.Scenario)='Actual',1,

if(Only({1} Market_Data.Scenario)=$(vCurLBEScenario),2,

if(Only({1} Market_Data.Scenario)=$(vPrevLBEScenario),3,

if(Only({1} Market_Data.Scenario)='Plan-16B',4,

if(Only({1} Market_Data.Scenario)='Standard-16',5,

if(Only({1} Market_Data.Scenario)='LBE_Feb',6,

if(Only({1} Market_Data.Scenario)='LBE_May',7,

if(Only({1} Market_Data.Scenario)='LBE_Aug',8,

if(Only({1} Market_Data.Scenario)='LBE_Nov',9)))))))))

View solution in original post

4 Replies
MarcoWedel

please post sample app

regards

Marco

sunny_talwar

May be this:

=if(Only({1} Market_Data.Scenario)='Actual',1,

if(Only({1} Market_Data.Scenario)=$(vCurLBEScenario),2,

if(Only({1} Market_Data.Scenario)=$(vPrevLBEScenario),3,

if(Only({1} Market_Data.Scenario)='Plan-16B',4,

if(Only({1} Market_Data.Scenario)='Standard-16',5,

if(Only({1} Market_Data.Scenario)='LBE_Feb',6,

if(Only({1} Market_Data.Scenario)='LBE_May',7,

if(Only({1} Market_Data.Scenario)='LBE_Aug',8,

if(Only({1} Market_Data.Scenario)='LBE_Nov',9)))))))))

Anonymous
Not applicable
Author

Yes, that's the answer.  Thanks

Can you describe what this does?  Thanks

sunny_talwar

We are using the {1} to tell your sorting expression to not change based on any selection. But the problem is that you can not use it with bare field, you can only use it between functions such as Sum, Median, Avg, Only etc and having a bare field is equivalent to having a only next to it. So for instance :- FieldName = Only(FieldName), but with the Only(FieldName) you can use set analysis, but with FieldName you cannot.

So I just added this to your expression -> Only({1} Market_Data.Scenario) anytime you had Market_Data.Scenario

I hope this will help.

Best,

Sunny