Documentation semantic question

I’m looking into array sorting of Associative Arrays and when I arrived at this page https://sdkdocs.roku.com/display/sdkdoc/ifArraySort
I became concerned that it says it’s implemented by roArray but not by roAssociativeArray.
But it actually does have the function for sorting AAs - should the page be updated to say that this is also implemented by roAssociativeArray?
thanks in advance.

“joetesta” wrote:
I’m looking into array sorting of Associative Arrays and when I arrived at this page https://sdkdocs.roku.com/display/sdkdoc/ifArraySort
I became concerned that it says it’s implemented by roArray but not by roAssociativeArray.
But it actually does have the function for sorting AAs - should the page be updated to say that this is also implemented by roAssociativeArray?
thanks in advance.

Arrays are sortable, associative arrays are not.
You can sort an array of associative arrays, but you are modifying the array itself, i.e. the order of items, and not modifying the array item values themselves.

When people speak - informally - about “sorting of dictionaries (assoc.arrays)”, in my experience we tend to mean accessing/enumerating the dictionary in particular order - either by order of keys or order of values.

Now, roAA have .keys() method that returns array of the keys, pre-sorted.
OTOH, there is no .values() method…

PS. I thought i’ll illustrate,

'for keys'
for each key in myAA.keys(): 'already sorted, haha!'
    do_the_due(key, myAA[key])
next

'for values - invert the dictionary'
inv_aa = {}
for each key in myAA:
    val = myAA[key]
    bucket = inv_aa[val]: if bucket=invalid then bucket = []: inv_aa[val] = bucket
    bucket.push(key)
next
for each vals in inv_aa:
    for each val in vals:
        do_the_due(vals[val], val)
    next
next

You’re right, I was hoping to sort on the keys and twisting my brain trying to figure out how to change my Associative Array so that the keys became sortable fields.
Ha - thanks again, yesterday I found the **.keys()** solution you’d posted earlier EnTerr, you are the best!!
-Joe