<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: ColdFusion Struct to Flex Untyped Object Gotcha</title>
	<atom:link href="http://www.kylehayes.info/2007/05/14/coldfusion-struct-to-flex-untyped-object-gotcha/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kylehayes.info/2007/05/14/coldfusion-struct-to-flex-untyped-object-gotcha/</link>
	<description>Rich Internet solutions utilizing Flex, ActionScript, JavaScript, Dojo, Objective-C, and the iPhone</description>
	<lastBuildDate>Tue, 09 Feb 2010 17:43:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Warren Koch</title>
		<link>http://www.kylehayes.info/2007/05/14/coldfusion-struct-to-flex-untyped-object-gotcha/comment-page-1/#comment-5383</link>
		<dc:creator>Warren Koch</dc:creator>
		<pubDate>Tue, 11 Aug 2009 18:37:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2007/05/14/ColdFusion-Struct-to-Flex-Untyped-Object-Gotcha#comment-5383</guid>
		<description>You mentioned that Flex could pass an ArrayCollection back to a ColdFusion CFC which would automatically interpret it as a ColdFusion query object.  I have been trying to get this to work but without success.  Can you share a code example?</description>
		<content:encoded><![CDATA[<p>You mentioned that Flex could pass an ArrayCollection back to a ColdFusion CFC which would automatically interpret it as a ColdFusion query object.  I have been trying to get this to work but without success.  Can you share a code example?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bobby</title>
		<link>http://www.kylehayes.info/2007/05/14/coldfusion-struct-to-flex-untyped-object-gotcha/comment-page-1/#comment-259</link>
		<dc:creator>Bobby</dc:creator>
		<pubDate>Thu, 12 Feb 2009 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2007/05/14/ColdFusion-Struct-to-Flex-Untyped-Object-Gotcha#comment-259</guid>
		<description>Did you guys get this figured out? I have the same problem with asp.net.</description>
		<content:encoded><![CDATA[<p>Did you guys get this figured out? I have the same problem with asp.net.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Novian</title>
		<link>http://www.kylehayes.info/2007/05/14/coldfusion-struct-to-flex-untyped-object-gotcha/comment-page-1/#comment-262</link>
		<dc:creator>Novian</dc:creator>
		<pubDate>Wed, 14 May 2008 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2007/05/14/ColdFusion-Struct-to-Flex-Untyped-Object-Gotcha#comment-262</guid>
		<description>Hi Dave,

Looks like you have some experience with arraycollections and CF. I&#039;m currently trying to pass an arraycollection to my cfc. I figured I should set the argument type as &#039;struct&#039;. Unfortunately, I get an error telling me that my my arraycollection is not of type struct. Setting it to array doesn&#039;t work either. Any thoughts?

Thanks.

Novian

Code:

&lt;cffunction name=&quot;saveQuiz&quot; access=&quot;remote&quot; returntype=&quot;boolean&quot; hint=&quot;Saves new quiz to quiz_questions.&quot;&gt;
    &lt;cfargument name=&quot;quizQuestion&quot; type=&quot;string&quot; required=&quot;yes&quot;&gt;
    &lt;cfargument name=&quot;quizAnswer&quot; type=&quot;string&quot; required=&quot;yes&quot;&gt;
    &lt;cfargument name=&quot;optionsAC&quot; type=&quot;struct&quot; required=&quot;yes&quot;&gt;
    &lt;cfset var qRead=&quot;&quot;&gt;
    &lt;cfquery name=&quot;savedQuizQuestion&quot; datasource=&quot;my_db&quot; result=&quot;savedQuizID&quot;&gt;
INSERT into quiz_questions (quizQuestion, quizAnswer)
VALUES (&#039;#ARGUMENTS.quizQuestion#&#039;, &#039;#ARGUMENTS.quizAnswer#&#039;)
	&lt;/cfquery&gt;
    &lt;cfloop from=&quot;1&quot; to=&quot;#ArrayLen(optionsAC.optionsArray)#&quot; index=&quot;i&quot;&gt; 
    &lt;cfquery name=&quot;savedQuizOptions&quot; datasource=&quot;my_db&quot;&gt;
INSERT into quiz_options (quizID, optionName, correct)
VALUES (&#039;#savedQuizID.GENERATED_KEY#&#039;, &#039;#optionsAC.optionsArray[i].label#&#039;, &#039;#optionsAC.optionsArray[i].data#&#039;)
&lt;/cfquery&gt;
&lt;/cfloop&gt;
    &lt;cfreturn true&gt;
    &lt;/cffunction&gt;</description>
		<content:encoded><![CDATA[<p>Hi Dave,</p>
<p>Looks like you have some experience with arraycollections and CF. I&#8217;m currently trying to pass an arraycollection to my cfc. I figured I should set the argument type as &#8217;struct&#8217;. Unfortunately, I get an error telling me that my my arraycollection is not of type struct. Setting it to array doesn&#8217;t work either. Any thoughts?</p>
<p>Thanks.</p>
<p>Novian</p>
<p>Code:</p>
<p>&lt;cffunction name=&quot;saveQuiz&quot; access=&quot;remote&quot; returntype=&quot;boolean&quot; hint=&quot;Saves new quiz to quiz_questions.&quot;&gt;<br />
    &lt;cfargument name=&quot;quizQuestion&quot; type=&quot;string&quot; required=&quot;yes&quot;&gt;<br />
    &lt;cfargument name=&quot;quizAnswer&quot; type=&quot;string&quot; required=&quot;yes&quot;&gt;<br />
    &lt;cfargument name=&quot;optionsAC&quot; type=&quot;struct&quot; required=&quot;yes&quot;&gt;<br />
    &lt;cfset var qRead=&quot;&quot;&gt;<br />
    &lt;cfquery name=&quot;savedQuizQuestion&quot; datasource=&quot;my_db&quot; result=&quot;savedQuizID&quot;&gt;<br />
INSERT into quiz_questions (quizQuestion, quizAnswer)<br />
VALUES (&#8216;#ARGUMENTS.quizQuestion#&#8217;, &#8216;#ARGUMENTS.quizAnswer#&#8217;)<br />
	&lt;/cfquery&gt;<br />
    &lt;cfloop from=&quot;1&quot; to=&quot;#ArrayLen(optionsAC.optionsArray)#&quot; index=&quot;i&quot;&gt;<br />
    &lt;cfquery name=&quot;savedQuizOptions&quot; datasource=&quot;my_db&quot;&gt;<br />
INSERT into quiz_options (quizID, optionName, correct)<br />
VALUES (&#8216;#savedQuizID.GENERATED_KEY#&#8217;, &#8216;#optionsAC.optionsArray[i].label#&#8217;, &#8216;#optionsAC.optionsArray[i].data#&#8217;)<br />
&lt;/cfquery&gt;<br />
&lt;/cfloop&gt;<br />
    &lt;cfreturn true&gt;<br />
    &lt;/cffunction&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kyle Hayes</title>
		<link>http://www.kylehayes.info/2007/05/14/coldfusion-struct-to-flex-untyped-object-gotcha/comment-page-1/#comment-258</link>
		<dc:creator>Kyle Hayes</dc:creator>
		<pubDate>Sat, 23 Feb 2008 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2007/05/14/ColdFusion-Struct-to-Flex-Untyped-Object-Gotcha#comment-258</guid>
		<description>@MnM - What does your ActionScript result handler look like?</description>
		<content:encoded><![CDATA[<p>@MnM &#8211; What does your ActionScript result handler look like?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MnM</title>
		<link>http://www.kylehayes.info/2007/05/14/coldfusion-struct-to-flex-untyped-object-gotcha/comment-page-1/#comment-257</link>
		<dc:creator>MnM</dc:creator>
		<pubDate>Fri, 22 Feb 2008 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2007/05/14/ColdFusion-Struct-to-Flex-Untyped-Object-Gotcha#comment-257</guid>
		<description>I&#039;m in a struggle with my arrayCollection and &quot;[object Object]&quot; also.  Any other insights to this?  Is this a problem with services-config.xml?  I can see datagrids fine.</description>
		<content:encoded><![CDATA[<p>I&#8217;m in a struggle with my arrayCollection and &quot;[object Object]&quot; also.  Any other insights to this?  Is this a problem with services-config.xml?  I can see datagrids fine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kyle Hayes</title>
		<link>http://www.kylehayes.info/2007/05/14/coldfusion-struct-to-flex-untyped-object-gotcha/comment-page-1/#comment-255</link>
		<dc:creator>Kyle Hayes</dc:creator>
		<pubDate>Thu, 14 Feb 2008 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2007/05/14/ColdFusion-Struct-to-Flex-Untyped-Object-Gotcha#comment-255</guid>
		<description>Hey Dave,

Try replacing in your result text:
ArrayCollection(e.result);

with

ArrayCollection(e.result as Array);</description>
		<content:encoded><![CDATA[<p>Hey Dave,</p>
<p>Try replacing in your result text:<br />
ArrayCollection(e.result);</p>
<p>with</p>
<p>ArrayCollection(e.result as Array);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kyle Hayes</title>
		<link>http://www.kylehayes.info/2007/05/14/coldfusion-struct-to-flex-untyped-object-gotcha/comment-page-1/#comment-256</link>
		<dc:creator>Kyle Hayes</dc:creator>
		<pubDate>Thu, 14 Feb 2008 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2007/05/14/ColdFusion-Struct-to-Flex-Untyped-Object-Gotcha#comment-256</guid>
		<description>@Dave - Something else I just noticed is that you are declaring your ArrayCollection twice. Which I am surprised Flex is even allowing you to do:

[Bindable]
public var dp:ArrayCollection = expenses;

[Bindable]
public var dp:ArrayCollection;</description>
		<content:encoded><![CDATA[<p>@Dave &#8211; Something else I just noticed is that you are declaring your ArrayCollection twice. Which I am surprised Flex is even allowing you to do:</p>
<p>[Bindable]<br />
public var dp:ArrayCollection = expenses;</p>
<p>[Bindable]<br />
public var dp:ArrayCollection;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dave</title>
		<link>http://www.kylehayes.info/2007/05/14/coldfusion-struct-to-flex-untyped-object-gotcha/comment-page-1/#comment-254</link>
		<dc:creator>dave</dc:creator>
		<pubDate>Wed, 13 Feb 2008 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2007/05/14/ColdFusion-Struct-to-Flex-Untyped-Object-Gotcha#comment-254</guid>
		<description>I am in a bit of a jam trying to figure out how
to get an array created in my cfc to populate a
lineChart.  The problem I am having is flex 
does not recognize the data type.  I have tried
array and struct.  The data is an array with 
structure.  I have posted the code to actionscript.orf 
http://www.actionscript.org/forums/showthread.php3?t=160828
 any sugestions as to how to make this work or
I am doing wrong would be great</description>
		<content:encoded><![CDATA[<p>I am in a bit of a jam trying to figure out how<br />
to get an array created in my cfc to populate a<br />
lineChart.  The problem I am having is flex<br />
does not recognize the data type.  I have tried<br />
array and struct.  The data is an array with<br />
structure.  I have posted the code to actionscript.orf<br />
<a href="http://www.actionscript.org/forums/showthread.php3?t=160828" rel="nofollow">http://www.actionscript.org/forums/showthread.php3?t=160828</a><br />
 any sugestions as to how to make this work or<br />
I am doing wrong would be great</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: morezy@gmail.com</title>
		<link>http://www.kylehayes.info/2007/05/14/coldfusion-struct-to-flex-untyped-object-gotcha/comment-page-1/#comment-252</link>
		<dc:creator>morezy@gmail.com</dc:creator>
		<pubDate>Fri, 14 Sep 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2007/05/14/ColdFusion-Struct-to-Flex-Untyped-Object-Gotcha#comment-252</guid>
		<description>//My Flex code:

var variables:URLVariables = new URLVariables(); 
variables.QueryFromFlex = ACprosResult; // ACprosResult = Flex ArrayCollection
		
//Setup a new request and sending the data through a post
var u:URLRequest = new URLRequest(&quot;http://mywebsite.com/displayFlexQuery.cfm&quot;);
u.data = variables;
u.method = URLRequestMethod.POST; 
//Navigate to the displayFlexQuery.cfm
 navigateToURL(u,&quot;_blank&quot;);

When I display the content of the Flex query, I have

//Alert.show(ObjectUtil.toString(ACprosResult));
(mx.collections::ArrayCollection)#0
  filterFunction = (null)
  length = 1
  list = (mx.collections::ArrayList)#1
    length = 1
    source = (Array)#2
      [0] (Object)#3
        FIRST_NAME = &quot;John&quot;
        mx_internal_uid = &quot;776493BC-342A-5F09-1ABA-042655F5D74&quot;
        LAST_NAME = &quot;Smith&quot;
    uid = &quot;BC170492-EAA0-57S1-1731-0426624F18B7&quot;
  sort = (null)
  source = (Array)#2
  
On displayFlexQuery.cfm file, I have:

&lt;table&gt;
	&lt;tr&gt;
		&lt;th&gt;First Name&lt;/th&gt;
		&lt;th&gt;Last Name&lt;/th&gt;
  	&lt;/tr&gt;
	&lt;cfoutput query=&quot;QueryFromFlex&quot;&gt;
		&lt;tr&gt;
			&lt;td&gt;#QueryFromFlex.FIRST_NAME#&lt;/td&gt;
			&lt;td&gt;#QueryFromFlex.LAST_NAME#&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/cfoutput&gt;
&lt;/table&gt;

Coldfusion throw this error:
 The value of the attribute query, which is currently &quot;[object Object]&quot;, is invalid.
 
 Any ideas?
 Thanks</description>
		<content:encoded><![CDATA[<p>//My Flex code:</p>
<p>var variables:URLVariables = new URLVariables();<br />
variables.QueryFromFlex = ACprosResult; // ACprosResult = Flex ArrayCollection</p>
<p>//Setup a new request and sending the data through a post<br />
var u:URLRequest = new URLRequest(&quot;http://mywebsite.com/displayFlexQuery.cfm&quot;);<br />
u.data = variables;<br />
u.method = URLRequestMethod.POST;<br />
//Navigate to the displayFlexQuery.cfm<br />
 navigateToURL(u,&quot;_blank&quot;);</p>
<p>When I display the content of the Flex query, I have</p>
<p>//Alert.show(ObjectUtil.toString(ACprosResult));<br />
(mx.collections::ArrayCollection)#0<br />
  filterFunction = (null)<br />
  length = 1<br />
  list = (mx.collections::ArrayList)#1<br />
    length = 1<br />
    source = (Array)#2<br />
      [0] (Object)#3<br />
        FIRST_NAME = &quot;John&quot;<br />
        mx_internal_uid = &quot;776493BC-342A-5F09-1ABA-042655F5D74&quot;<br />
        LAST_NAME = &quot;Smith&quot;<br />
    uid = &quot;BC170492-EAA0-57S1-1731-0426624F18B7&quot;<br />
  sort = (null)<br />
  source = (Array)#2</p>
<p>On displayFlexQuery.cfm file, I have:</p>
<p>&lt;table&gt;<br />
	&lt;tr&gt;<br />
		&lt;th&gt;First Name&lt;/th&gt;<br />
		&lt;th&gt;Last Name&lt;/th&gt;<br />
  	&lt;/tr&gt;<br />
	&lt;cfoutput query=&quot;QueryFromFlex&quot;&gt;<br />
		&lt;tr&gt;<br />
			&lt;td&gt;#QueryFromFlex.FIRST_NAME#&lt;/td&gt;<br />
			&lt;td&gt;#QueryFromFlex.LAST_NAME#&lt;/td&gt;<br />
		&lt;/tr&gt;<br />
	&lt;/cfoutput&gt;<br />
&lt;/table&gt;</p>
<p>Coldfusion throw this error:<br />
 The value of the attribute query, which is currently &quot;[object Object]&quot;, is invalid.</p>
<p> Any ideas?<br />
 Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kyle Hayes</title>
		<link>http://www.kylehayes.info/2007/05/14/coldfusion-struct-to-flex-untyped-object-gotcha/comment-page-1/#comment-253</link>
		<dc:creator>Kyle Hayes</dc:creator>
		<pubDate>Fri, 14 Sep 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.kylehayes.info/blog/index.cfm/2007/05/14/ColdFusion-Struct-to-Flex-Untyped-Object-Gotcha#comment-253</guid>
		<description>Sorry for being unclear. I left out an important factor. This ArrayCollection -&gt; Query Object transformation is only possible through a RemoteObject call in Flex (thus using the binary transmission of data versus a web service call or something similar.</description>
		<content:encoded><![CDATA[<p>Sorry for being unclear. I left out an important factor. This ArrayCollection -&gt; Query Object transformation is only possible through a RemoteObject call in Flex (thus using the binary transmission of data versus a web service call or something similar.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
