Creating the count method
The
method returns the number of records that would be returned by the fill method.
count
The return type of the
<cffunction name="count" output="no"
returntype="samples.contact.Contact[]" access="remote">
<cfargument name="param" type="string" required="no">
<cftry>
<cfset dao = CreateObject("component", "samples.contact.ContactDAO")>
<cfif structKeyExists(arguments, "param")>
<cfreturn dao.count(param=arguments.param)>
<cfelse>
<cfreturn dao.count()>
</cfif>
<!--- If the SQL failed, mark this change with the error. --->
<cfcatch type="database">
<cfset msg = "Error during count: " & cfcatch.queryError &
". SQL was :" & cfcatch.sql>
<cfset co.fail(msg)>
</cfcatch>
<!--- If anything else happened, mark this change with the error. --->
<cfcatch type="any">
<cfset co.fail(cfcatch.message & " " & cfcatch.detail)>
</cfcatch>
</cftry>
</cffunction>
52
Using the Flex Data Service Assembler
method is numeric. It appears as follows:
count
Need help?
Do you have a question about the COLDFUSION MX 7.0.2-USING COLDFUSION MX WITH FLEX 2 and is the answer not in the manual?