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: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Nikmd23
Sent: Wednesday, May 03, 2006 12:59 PM
To: [email protected]
Subject: [flexcoders] Re: DataService.fill params

 

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
(In CF)    Assembler.fill(a:String=null); which calls
(In CF)   DAO.read(b:Any, c:Any); - which I understand is flexable because I can change it to be whatever I want.  Correct? 

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,
Nik




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to