Marco,

I think the suggestion (and I might be mistaken) was based on the assumption
that under, say "poll" you have an array of PollingObjectID's corresponding
to the polling objects. So I assume here that you have a Poll type (as the
parent) and a PollingObject type as the 'child'. Then those two would have
different deleteData functions (they are different types). Then the
procedure would be:

   1. In delete function called for the parent object ("Poll"), get array of
   PollingObjectID's from the main Poll objectID (assuming that you used the
   array type to hold information about pollingobjects that the poll is
   holding)
   2. Before a loop, create an PollingObject via something similar to <cfset
   oFormtoolLogUtil = createObject("component",
   "farcry.core.packages.farcry.formtools") />
   3. Loop over PollingObjectID's, using (in my previous step example)
   oFormtoolLogUtil.delete(objectid = PollObjectIDLoop)
      1. or if you need the entire struct, first calling getData etc...
      2. You can also call the function with <cfinvoke ...> without the need
      to create an object in memory of the same type.
      4. Once that loop is completed, delete the main poll object.

I hope that makes sense.

I also responded (well, will respond after I finish this) to your thread
about excel output. That has an example of getting array of ObjectID's
relating to a parent. And might help you in figuring out your thoughts here.


Tomek

On Mon, Nov 3, 2008 at 1:03 PM, Marco van den Oever <
[EMAIL PROTECTED]> wrote:

>
> If there are 50 pollingvotes for a givven polling, i need to delete
> them all, and i can only delete them by their pollingobjectid field
> value that corresponds with the stobj.objectid.
> So even if i create a query loop, i can't delete using the delete
> function as i need to delete on the field pollingobject id and not on
> objectid.
>
> Or do i still not see it?
>
> Thanks
>
> On Nov 3, 1:45 pm, Sean Coyne <[EMAIL PROTECTED]> wrote:
> > if you are deleting one at a time, why not call a query to get
> > multiple, then loop over it and use the delete function to remove
> > them.  no need for a custom method.
> >
> > On Nov 2, 6:53 pm, Marco van den Oever <[EMAIL PROTECTED]>
> > wrote:
> >
> > > Ok as i understand now:
> >
> > > - i included a custom delete function which can enable custom code
> >
> > > - when you need to delete something based on a objectid value then you
> > > can use that custom delete function perfectly as it matches the needed
> > > arguments of the extended delete function
> >
> > > - when you need to delete something based on something else then a
> > > objectid you can't use that custom delete function
> >
> > > - so is my thought correct that you can extend functions and thereby
> > > use the framework in certain circumstances, but sometimes you are
> > > working more efficient by using such code as below?
> >
> > > - then i could call another custom function in that custom delete
> > > function but why call another function while i also could do this:
> >
> > >  <cfif stResult.bSuccess>
> > >     <!--- delete pollingvotes --->
> > >     <cfquery name="del_pollingvotes" datasource="#application.dsn#">
> > > DELETE FROM pollingvotes
> > >     WHERE pollingobjectid =
> > >     <cfqueryparam cfsqltype="cf_sql_varchar" value="#stObj.objectID#">
> > >     </cfquery>
> > >   </cfif>
> >
> > > Thanks
> >
> > > On Nov 2, 10:18 pm, Marco van den Oever <[EMAIL PROTECTED]>
> > > wrote:
> >
> > > > mmmm this deletes of course only one pollingvote instead of all...
> >
> > > > my main problem is that i need to know how to delete data not with
> the
> > > > objectid but with another id (in this case) the pollingobjectid.
> >
> > > > when i call:
> >
> > > > <cfset obj =
> > > > createObject('component',application.stcoapi.pollingvotes.typePath)>
> >
> > > > <cfset obj.deleteData(pollingobjectid=stobj.objectid) />
> >
> > > > in the custom function then i get the objectid needed statement, i
> > > > think because it is in the custom function it can't call itself so it
> > > > goes to the core delete function which requires the objectid.
> >
> > > > but i need this code to be inside the:
> >
> > > > <cfif stResult.bSuccess> </cfif>
> >
> > > > code that is in the function...
> >
> > > > any thoughts?
> >
> > > > On Nov 2, 9:13 pm, Marco van den Oever <[EMAIL PROTECTED]>
> > > > wrote:
> >
> > > > > Deep breath in, deep breath out.... now i got a working code:
> >
> > > > > <!--- delete pollingvotes --->
> >
> > > > > <cfset stObj = getData(arguments.objectID)>
> >
> > > > > <cfset obj =
> > > > >
> createObject('component',application.stcoapi.pollingvotes.typePath)>
> > > > > <cfset stprops = {} />
> > > > > <cfset stprops.conditions.pollingobjectid=stobj.objectid />
> > > > > <cfset deletevotes =
> > > > > obj.getMultipleByQuery(argumentCollection=stprops) />
> > > > > <cfset obj.deleteData(objectid=deletevotes.objectid) />
> >
> > > > > Any comments on how i did that, is it ok?
> >
> > > > > On Oct 22, 6:05 pm, Marco van den Oever <
> [EMAIL PROTECTED]>
> > > > > wrote:
> >
> > > > > > Ok got it, like you said, when you use a array or uuid then the
> > > > > > current object is of course the array or uuid table which you
> have to
> > > > > > address togetforeign keys from which enables you togetthe
> attacheddatafrom other tables:
> >
> > > > > > <!--- set the object  --->
> >
> > > > > > <cfset obj =
> > > > > > createObject('component',application.types.polling.typePath) />
> >
> > > > > > <!---getthe pollingdata where the value in "objectid" equals the
> > > > > > value in the (in this case) rulepolling "pollingobjectid" field
> --->
> >
> > > > > > <cfset pollingdata = obj.getData(stobj.pollingobjectid) />
> >
> > > > > > <cfdump var="#pollingdata#">
> >
> > > > > > On Oct 22, 4:51 pm, Marco van den Oever <
> [EMAIL PROTECTED]>
> > > > > > wrote:
> >
> > > > > > > I have a "objectid" in polling.cfc
> >
> > > > > > > a referring value in "pollingobjectid" in a rulepolling table
> >
> > > > > > > On Oct 22, 4:37 pm, Marco van den Oever <
> [EMAIL PROTECTED]>
> > > > > > > wrote:
> >
> > > > > > > > mmmm when i use the folowwing example iget, as it seems, only
> the
> > > > > > > > type structure and not the db values:
> >
> > > > > > > > <!---getthe pollingdata --->
> > > > > > > > <cfset obj =
> > > > > > > > createObject('component',application.types.polling.typePath)
> />
> > > > > > > > <cfset pollingdata = obj.getData(objectid) />
> > > > > > > > <cfdump var="#pollingdata#">
> >
> > > > > > > > what do i miss here?
> >
> > > > > > > > thanks
> >
> > > > > > > > On Oct 21, 3:31 pm, Marco van den Oever <
> [EMAIL PROTECTED]>
> > > > > > > > wrote:
> >
> > > > > > > > > Now that will ease the pain of creating cfc's, functions,
> invoking,
> > > > > > > > > WOW
> >
> > > > > > > > > Thanks :)
> >
> > > > > > > > > On Oct 21, 2:03 pm, Sean Coyne <[EMAIL PROTECTED]>
> wrote:
> >
> > > > > > > > > > <cfset obj =
> > > > > > > > > >
> createObject('component',application.types.polling.typePath) />
> > > > > > > > > > <cfset test = obj.getData(objectid) />
> > > > > > > > > > <cfdump var="#test#" />
> >
> > > > > > > > > > This willgetthe record from the Polling table where the
> objectid
> > > > > > > > > > equals the value in the "objectid" variable.
> >
> > > > > > > > > > Any arraydatatypes will contain the array of IDs and any
> UUIDdata
> > > > > > > > > > types in that Polling object will have the UUID to
> reference the
> > > > > > > > > > related objects.
> >
> > > > > > > > > > On Oct 20, 5:38 pm, Marco van den Oever <
> [EMAIL PROTECTED]>
> > > > > > > > > > wrote:
> >
> > > > > > > > > > > Ok for instance i have this test:
> >
> > > > > > > > > > > <cfset test = getData(stObj.ObjectID)>
> > > > > > > > > > > <cfdump var="#test#">
> >
> > > > > > > > > > > This willgetthe values of the current object which is a
> uuid table
> > > > > > > > > > > structure, but i want togetthe values of the polling
> table named
> > > > > > > > > > > polling (polling.cfc) which objectid is in the uuid
> table structure.
> > > > > > > > > > > How would i do that?
> >
> > > > > > > > > > > Thanks
> >
> > > > > > > > > > > On Oct 20, 8:53 pm, Marco van den Oever <
> [EMAIL PROTECTED]>
> > > > > > > > > > > wrote:
> >
> > > > > > > > > > > > awesome tomek, I'll go study the usage of this :)
> >
> > > > > > > > > > > > Thanks for your time
> >
> > > > > > > > > > > > On Oct 20, 3:01 pm, "Tomek Kott" <
> [EMAIL PROTECTED]> wrote:
> >
> > > > > > > > > > > > > Marco,
> >
> > > > > > > > > > > > > I think this may be what you're looking for:
> >
> > > > > > > > > > > > > What you would want to look at for those general
> functions is probably in
> > > > > > > > > > > > > farcry/core/fourq/fourq.cfc. That's what the basic
> types is extended from,
> > > > > > > > > > > > > and hence most of the other types. That said, you
> can also look athttp://www.farcrycore.org/cfcdoc/. I found this some other
> time, and
> > > > > > > > > > > > > although it's only FC5.0.0 (updated Aug 8), it's
> still useful I think. There
> > > > > > > > > > > > > you can browse by components (it doesn't have *all*
> of the code base) and
> > > > > > > > > > > > > search for fourq -> fourq.
> >
> > > > > > > > > > > > > If you're putting things on an execute page, I
> would probably use getData to
> > > > > > > > > > > > >getall of the current values, and then replace the
> ones you need, and then
> > > > > > > > > > > > > setData. setData is available to all content types,
> and you can put in any
> > > > > > > > > > > > > combination of proporties to update. createData is
> used for doing things the
> > > > > > > > > > > > > right way.
> >
> > > > > > > > > > > > > Once you find a suitable function, you might want
> to go back into your own
> > > > > > > > > > > > > code to make sure it works the same.
> >
> > > > > > > > > > > > > Best,
> >
> > > > > > > > > > > > > Tomek
> >
> > > > > > > > > > > > > On Mon, Oct 20, 2008 at 8:41 AM, Marco van den
> Oever <
> >
> > > > > > > > > > > > > [EMAIL PROTECTED]> wrote:
> >
> > > > > > > > > > > > > > Geoff thanks,  so you can use the framework to
> insert and update, but
> > > > > > > > > > > > > > also select? Where can i find info about how to
> work with that?
> > > > > > > > > > > > > > And what about when you need all kinds of
> functions that you normally
> > > > > > > > > > > > > > would put in to a functions component, this means
> that you have to
> > > > > > > > > > > > > > place all that kind of functions on the execute
> page?
> >
> > > > > > > > > > > > > > Tomek thanks, that is also my thought but
> understanding what Geoff
> > > > > > > > > > > > > > says it's possible to insert and update with the
> framework directly on
> > > > > > > > > > > > > > the execute page, that probably means that those
> default values as
> > > > > > > > > > > > > > "createdby" will be filled in automatically and
> correct.
> >
> > > > > > > > > > > > > > It's just a lack of understanding all the
> possibilities of the
> > > > > > > > > > > > > > framework etc that make me code more difficult
> then needed, but, we're
> > > > > > > > > > > > > > getting there :)
> >
> > > > > > > > > > > > > > On Oct 20, 4:03 am, "Tomek Kott" <
> [EMAIL PROTECTED]> wrote:
> > > > > > > > > > > > > > > My first brute force thought would be to simply
> go into the base type
> > > > > > > > > > > > > > (such
> > > > > > > > > > > > > > > as farcry.core.packages.types.type) and change
> the default value there to
> > > > > > > > > > > > > > > something like a space or something.
> > > > > > > > > > > > > > > Maybe I'm not quite understanding you though...
> >
> > > > > > > > > > > > > > > Although, you could always just create your own
> > > > > > > > > > > > > > > farcry.projects.packages.types.types and it
> would overwrite the default I
> > > > > > > > > > > > > > > believe. Maybe I'm wrong though, never know
> these days.
> >
> > > > > > > > > > > > > > > Tomek
> >
> > > > > > > > > > > > > > > On Sun, Oct 19, 2008 at 10:28 AM, Marco van den
> Oever <
> >
> > > > > > > > > > > > > > > [EMAIL PROTECTED]> wrote:
> >
> > > > > > > > > > > > > > > > I made i custom type that is not displayed on
> the site but purely used
> > > > > > > > > > > > > > > > as db structure generation through the deploy
> function.
> >
> > > > > > > > > > > > > > > > Automatically all kinds of default fields as
> "createdby" are
> > > > > > > > > > > > > > > > generated, i know that that is just the way
> >
> > ...
> >
> > read more ยป
> >
>

--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to