Topic: Help! Complex Output of Array of Nested Structures


FastCougar    -- 01-11-2006 @ 3:48 PM
  Background on this: I work for a logistics company where everything in the warehouse is barcoded. So, we have these barcode scanners that have a WindowsCE IE browser that I have written applications for. This is one of those applications. It allows the warehouse personnel to login and then start entering part numbers. I then return to screen an input for the count at the current location. This input builds the array of nested structures that you see in the dump (first link). I use ArrayPrepend() to build the array so that when I output the array later (can't seem to reference the key/value pairs in the nested structures because I don't know the key name when I'm looping through the array). The goal is to redisplay the array/nested structure information at the bottom of the screen so that edits can be made if a mistake happens. I'm using ArrayPrepend so that they don't need to scroll down the page to make the edit ... the last entered part number is at the top of the screen.

In a nutshell, I need this (cfdump of my array of nested structures):



To output to screen like this:



I'm completely stumped on how to reference the structure key/value pairs since the key must be obtained dynamically ... help!


Webmaster    -- 01-12-2006 @ 9:36 AM
  Here's a quick example (I am sure this will need further testing on your end).



<!--- First Loop the Array --->
<cfloop from="1" to="#ArrayLen(tMyArray)#" index="iOuter">
   <!--- Now Loop the outter structure --->
   <cfloop collection="#iOuter#" item="iStruct">
           <!--- Now loop the INNER structure --->
       <cfloop collection="#iStruct#" item="iInnerStruct">
             <!--- Now Display Structure --->
          #iInnerStruct# - StructFind(iStruct, iInnerStruct)<br>
          <!--- Keep in mind that with these values you could do a lot of things like for example insert into a temporary database then return the data in the format you want... you can also populate a temporary query object and then loop on that, etc... --->
           </cfloop>
   </cfloop>
</cfloop>

Pablo Varando
Senior Application Architect
EasyCFM.COM, LLC.

904.483.1457 \\ mobile
webmaster@easycfm.com \\email


Webmaster    -- 01-18-2006 @ 9:59 AM
  Did my example work for you?

Pablo Varando
Senior Application Architect
EasyCFM.COM, LLC.

904.483.1457 \\ mobile
webmaster@easycfm.com \\email


EasyCFM.COM ColdFusion Forums : http://www.easycfm.com/forums
Topic: http://www.easycfm.com/forums/viewmessages.cfm?Forum=12&Topic=8566