Sorting Deep Nested Arrays
brahma at hindu.org
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
border'>"&tR["amount"]&"</td></tr>" after 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
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