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

Order of concatination

Hi,

I have a function that creates a string based on the results of the adjacent field via concatination. But, the issue is that the order is not preserved at the end.

Using this formula :

=Concat(TOTAL <School, Class> Aggr(If(Excellent > Good, 'yes', 0), Year, School, Class), '|')

Output is like:

img.png

Normaly, the result should be "yes|0|yes", but its "0|yes|yes".

Is it possible to somehow resolve this issue?

updated formula due to wrong field existence

26 Replies
sunny_talwar

Conditional how?

Anonymous
Not applicable
Author

Is it clear from the image?

img2.png

Once disable class is clicked  - the field class disappears. But, as you see from second table, where there is no class field, the concatenation still relies on the class field.

sunny_talwar

Can you share this qvw file... will make it easier for me to test out

Anonymous
Not applicable
Author

updated file with buttons

sunny_talwar

Try this

=Concat(TOTAL <School, Class> Aggr(If(Excellent > Good, 'yes', 0), Year, School $(=if($(vShowClass)=0, ', Class', ''))), '', Year)

Anonymous
Not applicable
Author

Perfectly fine )

Anonymous
Not applicable
Author

Probably, I will bother you the whole day today. Upon some tests, I have encountered an issue. Here on the photo:

img3.png

I realize that the issue is with sorting inside concat. When I change Year to Class, the subtotal for Class is correct, but then the order for the Year disappears.

Is it possible to somehow work around this issue?

sunny_talwar

So, it almost looks like you want double sort... first by Class and next by Year

=Concat(TOTAL <School, Class> Aggr(If(Excellent > Good, 'yes', 'no'), Year, School $(=if($(vShowClass)=0, ', Class', ''))), '|',  Class + (Year/1E10))


Capture.PNG

Anonymous
Not applicable
Author

What does the highlighted part mean: Class + (Year/1E10) ???

sunny_talwar

1e10 = 10000000000

So, in order to give it a lower sort weight, I am dividing Year by 10000000000