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]
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry