Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 687

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Flex and AIR Integration in ColdFusion
<cffunction name="fill" output="no"
returntype="query" access="remote">
3
Array of structures:
<cffunction name="fill" output="no"
returntype="array" access="remote">
In addition to specifying the returntype of the
query, or an array of structures, you also do the following in the lower level
• Specify the returntype of the
<cffunction name="read" output="false" access="public"
samples.contact.Contact[]
returntype="
<cffunction name="read" output="false" access="public" returntype="
<cffunction name="read" output="false" access="public" returntype="
• If you are using Value Objects:
• Create the array to contain the Value Objects, as follows:
<cfset var ret = ArrayNew(1)>
• Loop through the query to create each Value Object based on each row of the query, for example:
<cfloop query="qRead">
<cfscript>
obj = createObject("component",
"samples.contact.Contact").init();
obj.setcontactId(qRead.contactId);
obj.setfirstName(qRead.firstName);
obj.setlastName(qRead.lastName);
obj.setaddress(qRead.address);
obj.setcity(qRead.city);
obj.setstate(qRead.state);
obj.setzip(qRead.zip);
obj.setphone(qRead.phone);
ArrayAppend(ret, obj);
</cfscript>
</cfloop>
• If you are using a query:
• Ensure that you configured the destination with the row type for the destination so that ColdFusion correctly
labels each rows in the query with the corresponding ActionScript type. Use the
which is in the metadata section of the destination.
• Specify the following in the
<cffunction name="fill" output="no" returntype="query"
access="remote">
<cfargument name="param" type="string" required="no">
<cfquery name="myQuery" .>
</cfquery>
<!--- Return the result --->
<cfreturn myQuery>
</cffunction>
• If you are using a DAO CFC, edit the
function depending on whether you are using Value Objects, a
fill
function as the Value Object CFC, a query, or an array, for example:
read
">
method:
fill
method to return a query instead of an array of CFCs.
read
Last updated 1/20/2012
function:
read
query
">
array
">
query-row-type
682
element,

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents