Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamic Sort value using IF

Hi All,

I have one requirement I have two fields Region and Type.

Type contains different types like Diamond, Gold, Platinum, Silver etc..

As per my requirement I need to sort Type dynamically as below

Default sort order for Type is 1.Diamond, 2.Gold, 3.Platinum, 4.Silver

But  in AMS region we don't have Gold type here sort should be like 1.Diamond, 2.Platinum, 3.Silver

In Europe region we don't have Platinum type here sort should be like 1.Diamond, 2.Gold, 3.Silver

My intension is first it should check the type if the value exists then assign number accordinglly.

If value is not exists then sort value should assign to next value as per order.

I want to display my values like Dimond-1,Gold-2,Platinum-3,Silver-4

Can anybody help me here to assign sort value dynaically using if condition or any other ideas?

Thanks,

QV11 User

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe like attached?

edit: updated sort order to be more intuitive

View solution in original post

15 Replies
Colin-Albert

Define the Type field as a dual value with the text and numbers in the order you want and the field will then sortas you require.

Dual function

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

In the Pivot table in your example, use the expression:

=Type & '-' & RowNo()

-Rob

Not applicable
Author

Hi Rob,

Thanks for your reply!

Actually my requirement is I need to pass Sort values dynamically in UI level.

For example if I click on AMS first it should start loop like if Diamond is available make it as 'Diamond-1'

Next it should search Gold if it's not there then it should search for Platinum then value as 'Platinum-2'

like that it should work.

I think using If it's possible but i'm not expert in creating IF loops

Thanks,

QV 11 User

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I don't understand. You already have the correct sort order as alphabetical. Where in the UI do you want to display "Diamond-1"?

-Rob

Not applicable
Author

Hi Rob,

If user selects Americas then three values for Region should store in a variable like as

"  Diamond-1,Platinum-2,Silver-3 "

If user selects Europe then three values for Region should store in a variable like as

"  Diamond-1,Gold-2,Silver-3 "

Thanks in advance,

QV11 User

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I'm not sure where you want the display to be. Can you mark up a QVW or a drawing?

-Rob

swuehl
MVP
MVP

Maybe like attached?

edit: updated sort order to be more intuitive

Not applicable
Author

Hi Swuehl,

Thank you very much for your time and solution.

This what exactly what i am expecting.

I'm getting lot of support & Information over community.

Once again Thank you very much.

Thanks,

QV11 User

mohan2391
Creator III
Creator III

Hi,

Can u please explain here itself what you have done in above QVW. We have personal edition only here.

Thank u