Yes, I'm using CF 8. How is this method sent on the cfc side and what do you do on the flex side if you are just returning one object?
lampei wrote: > > Are you using CF8? That's the only means (other than using Live Cycle or > Live Cycle Express) to get the __type__ method to work. > > --- In [email protected], hoz <h...@...> wrote: >> >> >> Hey guys, >> >> Figured it out. On Flex side: >> >> var public minList:Ministry >> minList = event.result as Ministry >> >> on CFC side: >> >> <cffunction name="getDept" output="false" access="remote" >> returntype="backstage.connect.com.services.Ministry"> >> >> <cfquery name="qRead" datasource="#application.dsn#"> >> SELECT >> ministryID, >> name, >> >> leader >> >> FROM connectionInfo >> WHERE departmentID = <cfqueryparam >> cfsqltype="cf_sql_integer" >> value="#ARGUMENTS.departmentID#"> >> </cfquery> >> >> <cfset var obj= >> createObject("component","backstage.connect.com.services.Ministry")> >> >> <cfscript> >> obj.ministryID = qRead.ministryID; >> obj.name = qRead.name; >> obj.leader = qRead.leader; >> obj.description = qRead.description >> </cfscript> >> >> <cfreturn obj> >> </cffunction> >> >> I would still like to use structs instead, _type_ notation; however, when >> I >> do this, it doesn't work. Anyone know how? >> >> >> >> hoz wrote: >> > >> > Hey guys, >> > >> > I understand how to convert an array from my cfc into an array >> > collection, populate a datagrid, and cast a selected Item to a VO. My >> > problem is if I'm returning just 1 DB record and want to convert to a >> > VO, so I can bind to a form (in other words, skip the populating a >> > datagrid with AC part), how do I do this? >> > >> > I thought I could do something like this: >> > >> > [Bindable] public var ministry:Ministry; >> > >> > ministry = event.result as Ministry; >> > >> > or >> > >> > var minList:Array = event.result as Array; >> > ministryList = new ArrayCollection(minList); >> > ministry = new Ministry(); >> > ministry = ministryList.getItemAt(0) as Ministry; >> > >> > I'm sure it's something simple I'm missing. Below is my cfc >> > >> > <cffunction name="getDept" output="false" access="remote" >> > returntype="array"> >> > <cfargument name="departmentID" type="numeric" required="yes"> >> > >> > <cfset var qRead=""> >> > <cfset var ret=arrayNew(1)> >> > >> > <cfquery name="qRead" datasource="#application.dsn#"> >> > SELECT >> > ministryID, >> > name, >> > >> > leader >> > >> > FROM connectionInfo >> > WHERE departmentID = <cfqueryparam >> > cfsqltype="cf_sql_integer" >> > value="#ARGUMENTS.departmentID#"> >> > </cfquery> >> > >> > <cfloop query="qRead"> >> > <cfscript> >> > stMin = structNew(); >> > stMin["_type_"] = >> > "backstage.connect.com.services.Ministry"; >> > stMin["ministryID"] = qRead.ministryID; >> > stMin["name"] = qRead.name; >> > stMin["leader"] = qRead.leader; >> > >> > ArrayAppend(ret, duplicate(stMin)); >> > >> > </cfscript> >> > </cfloop> >> > <cfreturn ret> >> > </cffunction> >> > >> > Thanks, >> > >> > Hoz >> > >> > >> > >> > >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/cfc-to-VO-pesky-problem-tp23255887p23262975.html >> Sent from the FlexCoders mailing list archive at Nabble.com. >> > > > > -- View this message in context: http://www.nabble.com/cfc-to-VO-pesky-problem-tp23255887p23277128.html Sent from the FlexCoders mailing list archive at Nabble.com.

