>From the depths of the FRB comes the voice of the prophet. He speaks words of 
wisdom for those who wish to listen. The words spoken now concern using numbers 
as a lookup index in a structure rather than text. 
This will be written up as a paper on www.fusionauthority.com.

The Book of Michael says:
An associative array is an alternative name for a structure. It also points to 
the ability of a structure to resemble an array in all ways. All you have to 
remember is that the lookup keys have to be text.
<HR>
<CFSCRIPT>
        // create an array with one dimension
        aTest=ArrayNew(1);
        // create a standard structure
        sTest=StructNew();
        // load the array with data using the standard set syntax
        aTest[1]="first";
        aTest[2]="second";
        /* load the structure with data using associative array syntax. Notice 
                that the numeric lookup id is surrounded by single quotes. This 
                causes ColdFusion to treat it as text and will therefore be 'legal' 
                as a structure lookup. Path lookups in this case will always fail 
                i.e. sTest.1 */
        sTest['1']="first";
        sTest['2']="second";
</CFSCRIPT>
<!--- Results to show that the test is working properly --->
<CFOUTPUT>
        #aTest[1]#<BR>
        #aTest[2]#<BR>
        #sTest['1']#<BR>
        #sTest['2']#<BR>
</CFOUTPUT>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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

Reply via email to