RE: [flexcoders] Re: DataService.fill params
Nik, You dont need to stick to the generated files. You can change them to fit your needs. João Fernandes Dep. Informática - Área de Desenvolvimento Cofina media Avenida João Crisóstomo, Nº 72 . 1069-043 Lisboa PORTUGAL Tel (+351) 213 185 200 . Fax (+351) 213 540 370 [EMAIL PROTECTED] From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nikmd23 Sent: quarta-feira, 3 de Maio de 2006 17:59 To: flexcoders@yahoogroups.com 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 methodtakes 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 Visit your group flexcoders on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] Re: DataService.fill params
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 Sent: Wednesday, May 03, 2006 12:59 PM To: flexcoders@yahoogroups.com 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 methodtakes 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 Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] Re: DataService.fill params
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 Sent: Wednesday, May 03, 2006 2:14 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Re: DataService.fill params 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 Sent: Wednesday, May 03, 2006 12:59 PM To: flexcoders@yahoogroups.com 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 methodtakes 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 Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.