- see footer for list info -<
Yes indeed, thanks. For me, the ultimate solution for cf would be an extra argument in ArrayNew:

    ArrayNew(nDimensions, type)

So for this case you have:

   myStruct = ArrayNew(1, "structure");
   myStruct [0].blah = "blah";

But hey, no point hyposthesising. Thanks for the solution.

Adrian Lynch wrote:

- see footer for list info -<
I had to look at that twice, I've always done it like this:

        myArray = ArrayNew(1);
        myArray[1] = StructNew();
        myArray[1].someKey = "some value";
        myArray[1].someOtherKey = "some other value";

Same result, different initialisation.


Although, if you can get away with:

        thisWillCreate.aStructure = "some value";

why couldn't they let us get away with:

        thisWill = ArrayNew(1);
        thisWill[1].dieOnItsArse = "some value";

Ade

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Stephen Moretti
Sent: 08 September 2005 12:14
To: Coldfusion Development
Subject: Re: [CF-Dev] Arrays of a structure

Yes - Just create an array and assign a struct to the slot in your array.

thisArray = arraynew(1);
thisRecord = StructNew();

thisRecord.field1 = 123;
thisRecord.field2 = 'abc';

thisArray[1] = thisRecord;

WriteOutput(thisArray[1].field1);


Regards

Stephen
_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
- Hosting provided by www.cfmxhosting.co.uk -<
- Forum provided by www.fusetalk.com -<
- DHTML Menus provided by www.APYCOM.com -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<


_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
- Hosting provided by www.cfmxhosting.co.uk -<
- Forum provided by www.fusetalk.com -<
- DHTML Menus provided by www.APYCOM.com -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to