Ok thanks both for all the help! On Aug 5, 5:36 pm, Sean Coyne <[email protected]> wrote: > One word of caution w/ Blair's approach though... > > If you are UPDATING an existing record that already has related > objects (ie aObjectIDs already has some values) then if you set it to > arrayNew(1) then aadd only the 1 item, then when FC saves the record, > it will only have 1 related item. It will delete the others. So just > use appropriately. If you are updating a record, be sure to use > getData to get the struct rather than creating it yourself. > > Sean > > On Aug 5, 7:39 am, Blair McKenzie <[email protected]> wrote: > > > Meaning you can do > > <cfset stProps.objectid = ... > > > <cfset stProps.typename = "dmNews"> > > <cfset stProps.aObjectIDs = arraynew(1)> > > <cfset arrayappend(stProps.aObjectIDs,...)> > > <cfset setData(stProperties=stProps)> > > > FarCry will find and update the right object. > > > On Thu, Aug 5, 2010 at 8:59 PM, Marco van den Oever < > > > [email protected]> wrote: > > > Ok, so in fact i could add just an extra stprops.typename = "dmNews" > > > and setData would create refCategories values? > > > > On Aug 5, 2:54 am, Blair McKenzie <[email protected]> wrote: > > > > A couple of things: > > > > - As long as the struct passed into stProperties has objectid and > > > typename, > > > > setData will handle the rest. > > > > - FC6.1 makes it possible to do the fourq's on array tables (and most > > > other > > > > arbitrary schema's), but as Sean says, it's still easier to let FarCry > > > > handle it. > > > > > Blair > > > > > On Wed, Aug 4, 2010 at 6:05 AM, Marco van den Oever < > > > > > [email protected]> wrote: > > > > > Awesome, thanks! > > > > > > On Aug 3, 9:56 pm, Sean Coyne <[email protected]> wrote: > > > > > > More or less. > > > > > > > The application.fapi.getcontenttype("dmNews") call may not work on > > > > > > your system (depending on your FarCry version) > > > > > > > and you can skip > > > > > > <cfset myObjectIdToAdd = dmimageobjectid /> > > > > > > <cfset arrayAppend(stNewsItem.aObjectIds,myObjectIdToAdd) /> > > > > > > > and just do > > > > > > <cfset arrayAppend(stNewsItem.aObjectIds,dmimageobjectid) /> > > > > > > > But yes, that is the way to add a related item to the parent record. > > > > > > > FarCry and setData will handle the "seq" and "typename" parts for > > > you. > > > > > > > On Aug 3, 10:59 am, Marco van den Oever <[email protected]> > > > > > > wrote: > > > > > > > > So: > > > > > > > > <cfquery datasource="aquariusage"> > > > > > > > INSERT INTO dmnews_aobjectids(data, > > > > > > > parentid, > > > > > > > seq, > > > > > > > typename) > > > > > > > VALUES('#dmimageobjectid#', > > > > > > > '#dmnewsobjectid#', > > > > > > > 1, > > > > > > > 'dmImage') > > > > > > > </cfquery> > > > > > > > > Becomes: > > > > > > > > <cfset oNews = application.fapi.getcontenttype("dmNews") /> > > > > > > > <cfset stNewsItem = oNews.getData(objectId = dmnewsobjectid) /> > > > > > > > <cfset myObjectIdToAdd = dmimageobjectid /> > > > > > > > > <cfset arrayAppend(stNewsItem.aObjectIds,myObjectIdToAdd) /> > > > > > > > > <cfset oNews.setData(stNewsItem) /> > > > > > > > > ??? > > > > > > > > On Aug 3, 3:50 pm, Sean Coyne <[email protected]> wrote: > > > > > > > > > The correct way would be to load the parent dmNews object then > > > append > > > > > > > > the records to the aObjectIDs array. > > > > > > > > > <cfset oNews = application.fapi.getcontenttype("dmNews") /> > > > > > > > > <cfset stNewsItem = oNews.getData(objectId = someObjectId) /> > > > > > > > > <cfset myObjectIdToAdd = "SOME UUID" /> > > > > > > > > > <cfset arrayAppend(stNewsItem.aObjectIds,myObjectIdToAdd) /> > > > > > > > > > <cfset oNews.setData(stNewsItem) /> > > > > > > > > > On Aug 2, 3:12 pm, Marco van den Oever < > > > [email protected]> > > > > > > > > wrote: > > > > > > > > > > mmm maybe because it's not a type and just a table so use a > > > > > query??? > > > > > > > > > Thanks... > > > > > > > > > > On Aug 2, 9:00 pm, Marco van den Oever < > > > [email protected] > > > > > > > > > > wrote: > > > > > > > > > > > I try to use <cfset obj = > > > > createObject('component',application.stcoapi.dmnews_aobjectids.typePath) / > > > > > > > > > > > > to manually set some values. > > > > > > > > > > > I get the message key [DMNEWS_AOBJECTIDS] doesn't exist in > > > struct > > > > > , > > > > > > > > > > why are those tables not in that struct? > > > > > > > > > > How should i add values manually to that table? > > > > > > -- > > > > > You received this message cos you are subscribed to "farcry-dev" > > > > > Google > > > > > group. > > > > > To post, email: [email protected] > > > > > To unsubscribe, email: > > > > > [email protected]<farcry-dev%2bunsubscr...@googlegrou > > > > > ps.com> > > > <farcry-dev%[email protected]<farcry-dev%252bunsubscr...@googl > > > egroups.com> > > > > > > For more options:http://groups.google.com/group/farcry-dev > > > > > -------------------------------- > > > > > Follow us on Twitter:http://twitter.com/farcry > > > > -- > > > You received this message cos you are subscribed to "farcry-dev" Google > > > group. > > > To post, email: [email protected] > > > To unsubscribe, email: > > > [email protected]<farcry-dev%2bunsubscr...@googlegrou > > > ps.com> > > > For more options:http://groups.google.com/group/farcry-dev > > > -------------------------------- > > > Follow us on Twitter:http://twitter.com/farcry
-- You received this message cos you are subscribed to "farcry-dev" Google group. To post, email: [email protected] To unsubscribe, email: [email protected] For more options: http://groups.google.com/group/farcry-dev -------------------------------- Follow us on Twitter: http://twitter.com/farcry
