Actually (after having read the most
recent flex api doc), the better way to solve this is to In our flex app just do this: var isActive:Boolean = false; var foo:String = "bar"; … var token:AsyncToken =
AsyncToken(ds.fill(contacts, isActive, foo)); Then in your cfc Assembler.cfc <cffunction name="fill"
output="no" returntype="samples.contact..Contact[]"
access="remote"> <cfargument
name="param" type="Any" required="no"> <cfargument
name="param2" type="Any" required="no"> … <cftry> <cfset
dao = CreateObject("component",
"samples.contact.ContactDAO")> <cfif
structKeyExists(arguments, "isActive")> <cfreturn
dao.read(isActive=arguments.isActive)> <cfelse> <cfreturn
dao.read()> </cfif> The DAO code is the same as below. --Bill From:
flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Bill Sahlas Right. What you want to do is first
create the Array (an AS3 Object) that you want to pass over to CF as the second
arg to the ds.fill() method. This object will contain an array of
arguments and their values. var myArgs:Object = {isActive:true,
foo:'bar'}; // OR you can dynamically assign the value as in var myArgs:Object = {isActive:myTextField.text,
foo:'bar'}; … // This is the call to the ds.fill()
method var token:AsyncToken =
AsyncToken(ds.fill(contacts, myArgs)); then in the cfc Assembler you can modify
your dao.read() method as follows
<cfif structKeyExists(arguments, "param")>
<cfreturn dao.read(isActive=arguments.param.isActive)>
<cfelse >
<cfreturn dao.read()>
</cfif> Your DAO may have as many arguments as you
want. For your example it may look like this <cffunction name="read"
output="false" access="public"
returntype="samples.contact.Contact[]">
<cfargument name="id" required="false">
<cfargument name="isActive"
required="false"> And your where clause would look like this <cfelseif structKeyExists(arguments,
"isActive")>
where isActive = <cfqueryparam cfsqltype="CF_SQL_BIT"
value="#arguments.isActive#"/> HTH, Bill From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf
Of Nikmd23 Thanks
Bill, that does help some, I do see in the DAO where I am supposed to change
the code. However,
I'm still confused as to how to pass the params out of flex. The
DataService.fill method takes a ListCollectionView, followed by an array.
FB2 won't let me write ds.fill(myCollection, arg1, arg2). But
then, even if I create an array with 1 element (a boolean:=true) - passing that
to CF seems to have an issue because the assembler's fill method takes one
param - a string. So here are my signatures: (In
Flex) DataService.fill(x:ListCollectionView, y:Array=null); which calls What
would I change on these signatures to make Flex's fill function either work
with an array, or N number of arguments? Thank
You,
|