Marketo tree sort order | Community
Skip to main content
keithnyberg
Level 7
April 29, 2026

Marketo tree sort order

  • April 29, 2026
  • 1 reply
  • 27 views

Back in 2020 when I was at Etumos I took the time to document that new UI’s tree sort order which was included in this blog post

When trying to lookup the full list today I noticed that there are some characters that were overlooked in that blog and also one anomaly that was not documented. Enjoy!

-
,
;
:
!
?
.
'
"
(
)
[
]
{
}
@
*
\
&
#
%
`
^
+
<
=
>
|
~
$
0
00
01
1
a
aa
b
_
__
__a
_a

*Note the oddity in “_a” not showing after “_” for some reason even though “a” is higher than “_” in the single character sort.

1 reply

SanfordWhiteman
Level 10
April 30, 2026

Nice!  That last thing doesn’t seem so odd (once you accept only leading  _ has special Marketo treatment) because the lexical order is _ __ __a _a.

The algo is like:
 

arr.sort( (a,b) => {
if( [a[0],b[0]].includes( "_" ) ) {
if( a[0] !== "_" ) return -1;
if( b[0] !== "_" ) return 1;
}
return a.localeCompare(b, undefined, { sensitivity: "base" } );
})

 

keithnyberg
Level 7
April 30, 2026

so in layman's terms, in normal lexicon order _ IS BEFORE lowercase letters but since Marketo has special behavior for leading _ (not secondary __) you get the situation above, right?

Next question, why would they create this anomaly?  Is this common in other systems?

SanfordWhiteman
Level 10
April 30, 2026

Right, exactly!

 

It’s purposeful so you can force certain folders to the bottom without messy stuff like “zArchive“.

 

EDIT: I originally implied the special sort order works for non-Latin-1 characters, too. It doesn’t: in a truly international world the _ won’t help. My sketch of the sorting algo in JS also isn’t totally correct, will update that.