I unfortunately have already been down this road, and it has no happy end. My issue was similar to yours: a multiple choice question w/ multiple answers, each of which was a complex object.
I ended up creating two custom types 1) e11MultChoiceQuestion 2) e11MultChoiceQuestionAnswer e11MultChoiceQuestion had an array property, which contained the objectids of the answers. You then need to maintain the array yourself in the edit logic when you save your parent object. Upside: you still get the benefit of using fourQ for DB operations. In fact, you could then reuse dmImage for your images. However, in your case, you might still get lucky. Instead of storing your images in an array, why not use a list, making the table column a string (nstring)? This of course assumes you only need to save the file name and no additional data (caption, etc.). HTH, Scott Toby Tremayne wrote: >Sigh. turns out it's not quite enough :) It works if I only want simple >constructs as the properties of the array, but in this case I want to >essentially embed another object in the array. The object type I'm using has >it's own array properties, and although the latter are only string values, >the cfc currently can't handle arrays as an array property. > >In case that's not clear, here's an example of how they're setup: > >stParentObj > aProducts > [1] stProduct > aImages > [1] image1.jpg > [2] image2.jpg > >with stParentObj being a type, and stProduct being another type. > >Well, truthfully I could be missing something, but I've setup the properties >as "aImages:array;" and they just don't get created as part of the table - or >as anything else. The data just goes missing when I store the parent object. > >I think the only way I'm going to be able to achieve the full instance >embedding is to serialize the object to be embedded. This tip will be useful >for simpler objects though, so thanks anyways! > >cheers, >Toby > >On Friday 24 February 2006 09:06, Toby Tremayne wrote: > > >>Magnificent - Scott you are a gentleman and an acrobat sir, thank you >>muchly! >> >>cheers, >>Toby >> >>On Friday 24 February 2006 08:53, Scott Talsma wrote: >> >> >>>Toby--I found the reference I was looking for. Have a look at >>>parseArrayProperty() in fourQ/TableMetadata.cfc >>> >>>Basically, set your property in the cfc as follows: >>> >>><cfproperty name="myprop" type="array" >>>arrayProps="id:number;fname:nstring;lname:nstring;city:nstring" /> >>> >>>That will create your table w/ 4 columns of the appropriate type. >>> >>> >>>Scott Talsma >>>CTO >>>echo.eleven >>>404.845.3458 >>> >>>-----Original Message----- >>>From: [email protected] [mailto:[EMAIL PROTECTED] On >>>Behalf Of Scott Talsma >>>Sent: Thursday, February 23, 2006 8:33 AM >>>To: [email protected] >>>Subject: [farcry-dev] Re: array of structs in an object property >>> >>> >>>I don't actually remember how to do this, but I have done it before, and >>>it works quite elegantly. The trick is to specify the properties of the >>>structure you are storing in the array when you declare the property >>>(cfproperty) in your custom type. The array table will then have the >>>appropriate columns. Have a look at /fourQ/gateway/MSSQLGateway >>> >>>Maybe search farcry_core for type="array" to see if any of the built-in >>>types use this feature. Or try to find the code that parses the >>>cfc.getMetaData() results. It would specify how complex arrays are >>>defined. >>> >>>Toby Tremayne wrote: >>> >>> >>>>Oh I'm storing it in memory fine, it's just when I want to put it in >>>>the database it will only work if it's a string, not a structure. Is >>>>there anything I haven't found yet that will allow for a structure? >>>> >>>>cheers, >>>>Toby >>>> >>>>On Thursday 23 February 2006 18:15, Geoff Bowers wrote: >>>> >>>> >>>>>Actually as of 3.0 fourq was extended to accommodate extended array >>>>>data whicyh would allow you to do what you are after. Unfortunately >>>>>this is totally undocumented feature. >>>>> >>>>>Sorry about that -- you would need to crawl around int he fourq code >>>>>to work this out. >>>>> >>>>>-- geoff >>>>>http://www.daemon.com.au/ >>>>> >>>>>Shib71 wrote: >>>>> >>>>> >>>>>>No. FarCry property arrays are basically arrays of 255char strings. >>>>>>If you want something bigger or more complex, you would be better off >>>>>>using a longchar property and storing WDDX. >>>>>> >>>>>>Blair >>>>>> >>>>>>On 2/23/06, *Toby Tremayne* <[EMAIL PROTECTED] >>>>>><mailto:[EMAIL PROTECTED]>> wrote: >>>>>> >>>>>> >>>>>> Hi all, >>>>>> >>>>>> is there any way I can get farcry to correctly store an >>>>>>array of structures >>>>>> in a property? For example, myObject.aSubObjects is an arrray, >>>>>>and I want >>>>>> each element of the array to contain a structure (the body of a >>>>>> different >>>>>> kind of object). Is there a proper way to do this without forcing >>>>>> me to >>>>>> >>>>>> serialize the data? >>>>>> >>>>>> cheers, >>>>>> Toby >>>>>> >>>>>> > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "farcry-dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/farcry-dev -~----------~----~----~----~------~----~------~--~---
