"Oh my complex mind"

Normally to set a item view + 1 i would need a code like:

(seperate cfc with functions)

<!--- set the current banner views + 1 --->
<cffunction name="viewsmade"  hint="this function sets the current
banner views + 1">
  <!--- method arguments --->
  <cfargument name="bannerid" type="string" required="yes"
hint="banner id to set the current banner views + 1">
  <cfquery name="viewsmade" datasource="#application.dsn#">
  UPDATE #application.dbowner#banners
  SET viewsmade = (viewsmade+1)
  WHERE ObjectID =
  <cfqueryparam cfsqltype="cf_sql_varchar"
value="#arguments.bannerid#">
  </cfquery>
</cffunction>

(invoke code on page that need the function)

<!--- set the current banner views + 1 --->
<cfinvoke
component="farcry.plugins.wsoFarcryBanners.packages.custom.customFunctions"
method="viewsmade" bannerid="#bannerID#"></cfinvoke>

Now with Farcry i only need:

<!--- set the current banner views + 1 --->
<cfset obj = createObject
('component',application.stcoapi.banners.typePath) />
<cfset viewsmade = obj.getData(bannerID) />

<cfset obj = createObject
('component',application.stcoapi.banners.typePath) />
<cfset stprops = {} />
<cfset stprops.objectid = bannerID />
<cfset stprops.viewsmade = viewsmade.viewsmade + 1 />
<cfset obj.setData(stProperties=stprops,user="anonymous") />

And it wouldn't be a surprise if i can do it even less complicated.

So my life is getting less and less complicated :)

On Nov 13, 1:05 am, Marco van den Oever <[EMAIL PROTECTED]>
wrote:
> I know there is a: <cffunction name="getRecordset"
>
> But is there also something as: <cffunction name="updateRecordset"
>
> In formtools.cfc i can't find such function, or am i missing
> something?
>
> Now i of course can do this updating by: <cfset obj.createData
> (stProperties=stprops) />
>
> But as i prefer working with the formtools way, is it possible?
>
> Also, what i the right way? Using formtools for getting data, and
> createdata for updating?
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
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