Cold Fusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingCold Fusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 26th, 2006, 02:44 PM
mattwiley mattwiley is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 1 mattwiley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 9 sec
Reputation Power: 0
Data structure question (an array of a cfc object)

I just picked up coldfusion about a month ago, so my coldfusion lingo sucks. I have been programming in C++ for over 5 years now and will be using a lot of C++ terminology to help avoid any confusion. I am writing a cfc function that preforms web servicing. This function needs to return an object/class that is defined in another cfc file. I can do this without a problem if I only need to return one instance of this object. However, I cannot seem to return an array of this object (I need to return multiple instances of this object, kind of like a query, but for programming purposes it needs to stay as an object).

It seems that the webservicing function hates my return type. If I try to make an array of the object, it does not like array or the object as the return type. However, when I take this function out of the cfc, and make it a cfm, it gets the array of objects just fine. So, I think I am having issues with the return type on the <cffunction> tag. So I came up with the idea of creating another object which will hold an array of the first object and using the second object as the return type. Here is some psuedo code of the function I am working on:

<cffunction name="SelectGames" access="remote" returntype="ArrayOfGames" output="false">
<!-- arguments --->
<!--- query --->
<cfobject component = "myArray" name>
<cfobject component="games" name="test">
<cfset counter = 0>
<cfloop query="getevents">
<cfset counter = counter + 1>
<cfset test.Game_id = event_id>
<cfset test.gameDate = eventdate>
<cfset test.Starttime = starttime>
<cfset test.Place = place>
<cfset test.Level = level>
<cfset test.Sport = sport>
<cfset test.Gender = division>
<cfset test.Opponent = opponent_id>
<cfset test.Type = type>
<cfset test.Link = spec_name>
<cfset myArray.gamesArray[counter] = test>
</cfloop>
<cfreturn myArray>
</cffunction>

It keeps telling me that it does not recognize the return type.
Here are examples of the two objects I am using from the 2 dif. cfc files:
<cfcomponent>
<cfproperty name="gamesArray" type="array">
</cfcomponent>
<cfcomponent>
<cfproperty name="Game_id" type="numeric">
<cfproperty name="gameDate" type="date">
<cfproperty name="Starttime" type="string">
<cfproperty name="Place" type="string">
<cfproperty name="Level" type="string">
<cfproperty name="Sport" type="string">
<cfproperty name="Gender" type="string">
<cfproperty name="Opponent" type="string">
<cfproperty name="Type" type="string">
<cfproperty name="Link" type="string">
</cfcomponent>

Feel free to post any questions to clear anything up, I know this is confusing and I probably did a poor job of explaining my problem. Also, if I throw this code into a cfm and try to make an array of games, it works, this is the code I got it to work with:
<cfset myArray = newArray(1)>
<cfloop query="getevents">
<cfset counter = counter + 1>
<cfset test.Game_id = event_id>
<cfset test.gameDate = eventdate>
<cfset test.Starttime = starttime>
<cfset test.Place = place>
<cfset test.Level = level>
<cfset test.Sport = sport>
<cfset test.Gender = division>
<cfset test.Opponent = opponent_id>
<cfset test.Type = type>
<cfset test.Link = spec_name>
<cfset myArray[counter] = test>
</cfloop>

I guess my problem is I do not know how to specify a type for an array.

Reply With Quote
  #2  
Old October 6th, 2006, 05:40 PM
jkmin jkmin is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2006
Posts: 1 jkmin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 25 sec
Reputation Power: 0
I am having the same problem

I am having the same problem. I am trying to return the array of custom Java class from the cfc as the return type, and I spent several days trying to find out how, but failed so far.

If you know how to do it by now, could you be kind enough to post it here or email to me?

Thank you very much.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingCold Fusion Development > Data structure question (an array of a cfc object)


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap