Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
rulohx87
Contributor III
Contributor III

Bubble Sort in QlikView

¡Hey!

I would like use this code in an expression. Which are the functions? There are a "FOR" or "WHILE"?

This code is Java.

Codigo

int A[] = {20,10,50,70};

int Aux= 0;

   for(int i=0; i < A.length-1; i++)

    {

      System.out.println("  EMP: "+i+" "+A);

         for(int j = 0; j < A.length-i-1 ; j++)

           {

                   System.out.println("J: "+j+" "+A);

                   f(A[j+1] < A )

                        {

                                Aux = A[j+1];

                                A[j+1] = A;

                                A = Aux;

                         }

              }

     }

1 Solution

Accepted Solutions
jerem1234
Specialist II
Specialist II

Maybe you would be able to use something like:

pick(match(rangemax(sum(V1), sum(V2), sum(V3)), sum(V1), sum(V2), sum(V3)), 'V1', 'V2', 'V3')

Replace V1, V2, ... with your pictures.

Just be careful when you have 2 sums that are the max, will pick the first one in list.

Just to clarify, V1, V2, ... are separate fields right?

Hope this helps!

View solution in original post

11 Replies
Colin-Albert

Why re-engineer QlikView?

Create a field that contains the data you want to sort on, and use this as the sort field in your charts.

rulohx87
Contributor III
Contributor III
Author

Because the information is in multiple columns and the idea is to create a "text object" dynamic with the photo of the seller who sold more in this city. The objective is to determine the first, second and third place for each city. I'm doing it with "IF" but it is very slow.

          V1  V2  V3 ... Vn

USA    5   3   1 ...

U.K.    1   2   2  ...

Mex    7   0   9  ...

...

Country_n

Not applicable

use concat() function

there is an argument to sort the field you want to display

Fabrice

Colin-Albert

Can you post your current expression?

Not applicable

Perhaps you may use also FirstSortedValue()

There is an argument to take the nth value

If you have only 3 texts to display, you can use this function for the 1st one & this function for the second one ....

Fabrice

rulohx87
Contributor III
Contributor III
Author

This is my idea. However, this is only 3 columns and easy. But it is not the same with 10 columns.  For the "text object" information is dynamic.

ej.png

rulohx87
Contributor III
Contributor III
Author

I'll try. Thanks for the tip.

Not applicable

Oh no

As Colin said, do not re-engeneer QlikView: use in-built function that do the sort for you, that will take the top 3 etc.

If you want to display images, you can do

1) load into a field the path to the images

2) display this field as an image (not text). You have this possibility into the table or the text box

Fabrice

rulohx87
Contributor III
Contributor III
Author

OK. I thought that I could make a little more simple. I think my code is very big with "IF" lol