Need a little assistance with a struct/array problem please!
-----------------------------------------------------------------------------------
Data in question is coming from ONE row in the database.
There are six "fpcomm" cells: fpcomm1,fpcomm2, ... and so on
There are also six "fpord" cells: fpord1, fpord2, ... and so on
So, I need to display the contents of the fpcomm cells, ordered by the
integer in the fpord cells.
My query is "getNEWS".
The below works great, and sorts the results as I need.
<cfset allNEWS = StructNew()>
<cfloop from="1" to="6" index="i">
<cfset oneSTORY = StructNew()>
<cfset oneSTORY.cellID = "#i#">
<cfset oneSTORY.ord = "#getNEWS["fpord#i#"][1]#">
<cfset oneSTORY.cell = "#getNEWS["fpcomm#i#"][1]#">
<cfset allNEWS[oneSTORY.cell] = oneSTORY>
</cfloop>
<cfset sortedKeys = StructSort(allNEWS, "numeric", "asc", "ord")>
Here's the problem, maybe fpcomm5 and fpcomm6 are EMPTY (or NULL) on a
particular day. REGARDLESS, I still need all six positions in
"sortedKeys" returned.
Let's say for the moment that fpcomm5 and fpcomm6 cells are empty. If I
do a dump of "sortedKeys", I'll get:
array
1 Item One
2 Item Two
3 Something Else
4 Even Something Else
5 [empty string]
It INCLUDES the first emtpy row (fpcomm5), but NOT fpcomm6, which looks
exactly like fpcomm5 in the database.
If fpcomm4, 5, and 6 are empty, it will include fpcomm4, but not 5 and 6.
Weird - it only include the FIRST empty element....
I need the array to always include all six elements. [empty string] is
exactly what I need - but I need ALL of them.
Suggestions?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351660
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm