And my service looks like this:

<cffunction name="getComments" access="public" returntype="any">
<cfargument name="transactionid" required="true" />
<cfargument name="entered_by" />
<cfargument name="comment" />
<cfargument name="date_recorded" />
<!--- other --->
 <cfargument name="returnformat" default="query" hints="options: array, 
struct, query, xml, json" />

<cfset var qList = "" />
<cfset var result = "" />

<cftry>
<cfset qList = getInvoiceGateway().getComments(argumentCollection=arguments) 
/>

<cfswitch expression="#arguments.returnformat#">
<cfcase value="array">
<cfset result = getUtilsService().queryToArrayOfStructs(qList) />
</cfcase>
<cfcase value="struct">
<cfset result = getUtilsService().queryToStructOfStructs(qList, 'commentid') 
/>
</cfcase>
<cfcase value="json">
<cfset result = getUtilsService().queryToJSON(qList) />
</cfcase>
<cfcase value="xml">
<cfset result = getUtilsService().queryToXML(qList) />
</cfcase>
<cfcase value="html">
<cfset result = getUtilsService().queryToHTML(qList, 
"comment,entered_by,date_recorded") />
</cfcase>
<cfdefaultcase>
<cfset result = qList />
</cfdefaultcase>
</cfswitch>

<cfif arguments.dump>
<cfdump var="#result#" abort="true" label="#arguments.returnformat#" />
</cfif>

<cfcatch>
<cfset result = cfcatch.Message />
</cfcatch>
</cftry>

<cfreturn result />
</cffunction>

-- 
To post to this group, send email to mach-ii-for-coldfusion@googlegroups.com
For more options and to unsubscribe, visit this group at 
http://groups.google.com/group/mach-ii-for-coldfusion?hl=en

SVN: http://svn.mach-ii.com/machii/
Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/

Reply via email to