4 Replies Latest reply: Feb 15, 2016 4:51 AM by Nathaniel Anderson

# Unexpected sort on a Calculated Dimension: [Line] & ' ' & [Label]

Simple List Boxes, the third of which doesn't sort how I expect.

Now I can think of various confounding factors:

• The calculated dimension that combines two dimensions: [Line] & ' ' & [Label]
• The fact that I load the same dataset, and then reload it again

And so I can workaround and achieve my expected behavior

• Separate Line and Label dimensions (could use a Chart if needed)

But I can't wrap my head around why these things (might) cause the unexpected the results.

• ###### Re: Unexpected sort on a Calculated Dimension: [Line] & ' ' & [Label]

By the way, I say I "expect" Text(Line) to sort like this:

1a

1b

2

3

4

5

6

7

8

9

10

11

12

13a

13b

But if it were lexicographic sorting, wouldn't it be:

10

11

12

13a

13b

1a

1b

2

3

4

5

6

7

8

9

As demonstrated here in my Chrome Javascript console:

l=['1a','1b','2','3','4','5','6','7','8','9','10','11','12','13a','13b']

["1a", "1b", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13a", "13b"]

l.sort()

["10", "11", "12", "13a", "13b", "1a", "1b", "2", "3", "4", "5", "6", "7", "8", "9"]

• ###### Re: Unexpected sort on a Calculated Dimension: [Line] & ' ' & [Label]

And I wasn't sure why these expressions behave differently:

• Text(Line)
• Num#(PurgeChar(Num, 'abcd'))
• ###### Re: Unexpected sort on a Calculated Dimension: [Line] & ' ' & [Label]

Particularly if I first sort on "Expression" Num#(PurgeChar(...)), Ascending but I also check the "Text" checkbox, what's the difference?