Skip to main content
Inspiring
February 25, 2008
Question

Tring the counts

  • February 25, 2008
  • 2 replies
  • 285 views
i got this query from my colleage as i was also unable to solve this:

this is like as:

<cfquery datasource="#request.dsn#">
UPDATE table1
SET
table1.quest = quest - COUNT(#form.delmode#)
where
ID IN (<cfqueryparam cfsqltype="cf_sql_numeric" value="#trim(ID)#" list="yes">)
</cfquery>

form.delmode gets the value from the page where the values come as: 9,11,14,21,33

that comes up to 5

so what he wants is:

update table1 set table1 - COUNT(#form.delmode#) in this case say 5

hope anyhow this gets up working..
    This topic has been closed for replies.

    2 replies

    Inspiring
    February 25, 2008
    Looks like the question changed after the first answer. For the current version, the listlen function comes to mind. Details are in the cfml reference manual. If you don't have one, the internet does.
    Inspiring
    February 25, 2008
    > dude the above syntax u provided for coldfusion 7 and above can u explain it in bit more detail and now else it is liittle incomplete??/

    CF is built atop of Java, so all CF data types are intrinsically also some
    manner of Java class. In the case of CF arrays, they are an implementation
    of the java.util.Vector class, so one can call methods of that class on a
    CF array.

    The docs for java.util.Vector are here:

    http://java.sun.com/j2se/1.4.2/docs/api/java/util/Vector.html

    --
    Adam