Finally :) got it working, what i needed was the example of using the
formtools, this gave me back my 'hands and feets' so to speak.

- so a plain getData( is for getting data from a type by using one
parameter ?
- a getMultiplebyquery( is for getting data from a type by using
multiple parameters
- and by using the formtools like below you get create your own
query's

Thanks all!

For the one following it now or in the future:

<cfset oFormtoolUtil = createObject("component",
"farcry.core.packages.farcry.formtools") />
    <cfset sqlColumns="objectid,pollingobjectid" />
    <cfset stRecordset =
oFormtoolUtil.getRecordset(sqlColumns=sqlColumns,
sqlWhere="pollingobjectid = '#arguments.objectID#'",
typename="pollingvotes",
bCheckVersions=true) />

 <cfset stResult = super.delete(objectid=arguments.objectID)>

  <cfif stResult.bSuccess>

    <!--- delete pollingvotes --->
        <cfloop query="stRecordset.q">

        <cfset obj
=createObject('component',application.stcoapi.pollingvotes.typePath)>
        <cfset obj.delete(objectid=stRecordset.q.objectid) />

        </cfloop>

    <!--- delete application.wsoFarcryPolling_stats_objectid so
deleted polling id will not be available --->
    <cfset
structdelete(Application,'wsoFarcryPolling_stats_objectid')>

 </cfif>
  <cfreturn stResult>

On Nov 4, 12:31 am, Marco van den Oever <[EMAIL PROTECTED]>
wrote:
> I believe that is a very strong opinion, i am convinced!
> Thanks for sharing.
>
> On Nov 4, 12:14 am, "Tomek Kott" <[EMAIL PROTECTED]> wrote:
>
> > Well, I would imagine that setting a delete query in there is faster, but
> > probably not by so much as to make the 'long' way unworkable. But doing it
> > the "long" way around makes sure that the sql code stays platform
> > independent, as all of that can be handled by the database gateway of the
> > FourQ layer. Plus it gives one less area where SQL queries have to be
> > checked for correctneess.
>
> > That's the reason I would do it the more abstract way. Others might have
> > stronger opinions.
>
> > Best,
>
> > Tomek
>
> > On Mon, Nov 3, 2008 at 3:47 PM, Marco van den Oever <
>
> > [EMAIL PROTECTED]> wrote:
>
> > > Ok i begin to see more light at the end of the tunnel so to speak,
> > > shortly, get an array of the objectid's from the pollingvotes where
> > > the pollingobjectid is equal to stobj.objectid.
>
> > > Then loop a delete function which can now use the objectid argument as
> > > it's in the array.
>
> > > That said, isn't that more complicated then just set a delete query in
> > > there? Or is it faster like this?
>
> > > On Nov 3, 8:39 pm, "Tomek Kott" <[EMAIL PROTECTED]> wrote:
> > > > 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
>
> ...
>
> 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