Sorting Deep Nested Arrays

Brahmanathswami brahma at
Tue Dec 3 21:19:24 EST 2013

I have a deep nested array that I want to push out to a  table.
It needs to be ordered/sorted by the "start_date"   which is data the 
lies "deep down" at the "end" of the levels.

The incoming data is from MySQL and my query sorts the data, but then 
after poking this into an array the sort is lost.

This is actually being done in RevIgniter, but I still think it's a 
generic LiveCode use case regardless of context.

   put empty into tBuf
           repeat for each key tE in gData["task-hours"]["entries"]
             put gData["task-hours "]["entries"][tE] into tR
             put "<tr><td class='border'>"&tR["start_time"]&"</td><td 
class='border'>"&tR["task"]&"</td><td class='description 
class='border'>"&tR["budget"]&"</td><td class='aRight 
border'>"&tR["amount"]&"</td></tr>" after tBuf
           end repeat
           return tBuf

OK... let's forget about the mark up...

For each key "tE" in this array


We have a value that is another array with keys

start time

real data/values looks like

2013-07-01 06:00:00    some task    A description        GKWeb    12:04:00*

*I want to sort these from the outset by the start date.
Is there a way?

Multi-level arrays are very cool, but a bit labyrinthine to the
point of being so opaque they start to be black boxes!

Swasti Astu, Be Well!

More information about the Use-livecode mailing list