Hey gang -
Thought I'd toss this out to the peanut gallery and see what comes back. I'm
positive I can come up with a fix, but it'll be a workaround and I'd prefer
something more efficient/elegant than the way I'm thinking.
I've got a large structure, basically a bunch of
structures-within-structures. Farther down in the tree, I want to have the
keys sorted by the values of variables a bit farther in on the tree. For
example, here's some faked up values:
Level1[1001].Points = 50
Level1[1002].Points = 100
Level1[1003].Points = 75
So StructSort will work on the keys themselves - i.e. the sort would end up
1001,1002,1003. But what I want is the sort to be based on the "Points"
value, so I end up with the keys sorted 1002,1003,1001. Another issue is I
could have multiple occurances of the same point value. I'm not worried
about which occurance (and corresponding key) of double point values comes
first, FYI.
I know I could do some goofy stuff with building lists out of the keys and
point values, making a sorted copy of the point list, doing a bunch of
finds/getats and creating my own list of sorted keys, but what I'd really
like is to have the structure *itself* sorted properly. I build this
structure when things change, WDDXify it and store it in a DB table; when I
want to display, I just query the table, grab the packet, unWDDX it, and
loop on it. If I can have the sorted-by-point thing carry through all that
so I can just loop/display and it be in the right order, that's the goal.
Thanks in advance,
--Scott
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists