First, I was not sure on which forum to post the question.
Second, it seems to be no easily answered, so it pays then to try more.
I tried to sort the array first:
<cfset sortedKeysTD = StructSort(TD, "text", "desc")>
Then I did the loop:
<cfloop index="i" from="1" to="#ArrayLen(TH)#">
When I try to run this (more or less simple code), I have an error:
You have attempted to dereference a scalar variable of type class coldfusion.runtime.Array as a structure with members.
Any thoughts ?
I will appreciate any ideas.
The next command, which caused the error was:
Whatever you tried to do, you tried to do to the entire array instead of the array element.
No harm done with cross-posting. But as a general rule, just pick one of the forums and if it's the wrong one (which unless your question is nothing to do with CF, is not likely to be the case), someone will let you know ;-) The reason not to cross-post is that it splits people's efforts in trying to help you, which could waste their time. And yours.
Anyway, did you investigate my response to you on the other thread? I have a strong feeling that that's your actual answer...
Yes, I solved the issue twice:
1. partially (1 key sort) - with arrays of structures- using shadow arrays
2. fully- much better- using query objects- any type of sort I want,
Thank you !
Considering that you did not want to try http://www.cflib.org/udf/QuickSort as was suggested earlier, I do not know what to suggest...
Convert your array of structs to query object and run QoQ with your sort order...
You are correct- done this- works fine !
I should not waste my time with arrays of structures- not nicely supported
and straightforward as in PL/1, for example...