CFC Not Returning JSON properly from an array
I have a CFC that I'm trying to return JSON data in a web service.=20 If I do a dump before I return the code to the calling program, the JSON is= fine. However it returns this to the calling program:[\\\n\\t\\n\\t\\t\\= n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\= t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\= t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio= \\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\= t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\= t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\= n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\= t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\= t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\= n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\= t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\\/category\\n\\t= \\t\\\/category\\n\\t\\\/category\\n\\t\\n\\t\\t\\n\\t\\t\\\/category= \\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\\/portfolio\\n\\t\\t\\n\\t\\t\\\/categor= y\\n\\t\\t\\n\\t\\t\\\/category\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\\/portfo= lio\\n\\t\\t\\n\\t\\t\\\/portfolio\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\t\\= n\\t\\t\\t\\t\\n\\t\\t\\t\\\/portfolio\\n\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\= t\\t\\t\\n\\t\\t\\t\\\/portfolio\\n\\t\\t\\\/category\\n\\t\\t\\n\\t\\t= \\\/portfolio\\n\\t\\\/category\\n\\t\\n\\t\\\/portfolio\\n\\t\\n\\t= \\\/portfolio\\n\\t\\n\\t\\\/portfolio\\n\\\/root\,\\\n\\t\\n\\t\\\= /category\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\= t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\= \\/portfolio\\n\\t\\n\\t\\\/category\\n\\t\\n\\t\\\/category\\n\\\/ro= ot\] What am I doing wrong? Thanks in advance. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357935 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CFC Not Returning JSON properly from an array
Are you doing SerializeJSON() in your CFC method, AND have returntype=JSON on the function definition? If so, it is double serializing the data. Remove the SerializeJSON() call and allow the function to automatically do the serialization. HTH, -Carl V. On 3/14/2014 12:26 PM, Rixon Reed wrote: I have a CFC that I'm trying to return JSON data in a web service.=20 If I do a dump before I return the code to the calling program, the JSON is= fine. However it returns this to the calling program:[\\\n\\t\\n\\t\\t\\= n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\= t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\= t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio= \\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\= t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\= t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\= n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\= t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\= t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\= n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\= t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\\/category\\n\\t= \\t\\\/category\\n\\t\\\/category\\n\\t\\n\\t\\t\\n\\t\\t\\\/category= \\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\\/portfolio\\n\\t\\t\\n\\t\\t\\\/categor= y\\n\\t\\t\\n\\t\\t\\\/category\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\\/portfo= lio\\n\\t\\t\\n\\t\\t\\\/portfolio\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\t\\= n\\t\\t\\t\\t\\n\\t\\t\\t\\\/portfolio\\n\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\= t\\t\\t\\n\\t\\t\\t\\\/portfolio\\n\\t\\t\\\/category\\n\\t\\t\\n\\t\\t= \\\/portfolio\\n\\t\\\/category\\n\\t\\n\\t\\\/portfolio\\n\\t\\n\\t= \\\/portfolio\\n\\t\\n\\t\\\/portfolio\\n\\\/root\,\\\n\\t\\n\\t\\\= /category\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\= t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\= \\/portfolio\\n\\t\\n\\t\\\/category\\n\\t\\n\\t\\\/category\\n\\\/ro= ot\] What am I doing wrong? Thanks in advance. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357936 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CFC Not Returning JSON properly from an array
The default for the return format for a remote cffunction call is WDDX. Sounds like inside your CFC you are serializing the return value first. So something like return serializeJson(myValue); If the return string in this case is JSON, then your remote call to the CFC should include a returnformat=plain, to return the string as is. Byron Mann Lead Engineer Architect HostMySite.com On Fri, Mar 14, 2014 at 3:26 PM, Rixon Reed ri...@photoeye.com wrote: I have a CFC that I'm trying to return JSON data in a web service.=20 If I do a dump before I return the code to the calling program, the JSON is= fine. However it returns this to the calling program:[\\\n\\t\\n\\t\\t\\= n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\= t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\= t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio= \\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\= t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\= t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\= n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\= t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\= t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\= n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\= t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\\/category\\n\\t= \\t\\\/category\\n\\t\\\/category\\n\\t\\n\\t\\t\\n\\t\\t\\\/category= \\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\\/portfolio\\n\\t\\t\\n\\t\\t\\\/categor= y\\n\\t\\t\\n\\t\\t\\\/category\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\\/portfo= lio\\n\\t\\t\\n\\t\\t\\\/portfolio\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\t\\= n\\t\\t\\t\\t\\n\\t\\t\\t\\\/portfolio\\n\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\= t\\t\\t\\n\\t\\t\\t\\\/portfolio\\n\\t\\t\\\/category\\n\\t\\t\\n\\t\\t= \\\/portfolio\\n\\t\\\/category\\n\\t\\n\\t\\\/portfolio\\n\\t\\n\\t= \\\/portfolio\\n\\t\\n\\t\\\/portfolio\\n\\\/root\,\\\n\\t\\n\\t\\\= /category\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\= t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\= \\/portfolio\\n\\t\\n\\t\\\/category\\n\\t\\n\\t\\\/category\\n\\\/ro= ot\] What am I doing wrong? Thanks in advance. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357937 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CFC Not Returning JSON properly from an array
on your ajax call, did you add returnformat: 'json' as one of your post data arguments? If you don't specify this, then the remote method will return WDDX by default. Steve 'Cutter' Blades Adobe Community Professional Adobe Certified Expert Advanced Macromedia ColdFusion MX 7 Developer http://cutterscrossing.com Co-Author Learning Ext JS 3.2 Packt Publishing 2010 https://www.packtpub.com/learning-ext-js-3-2-for-building-dynamic-desktop-style-user-interfaces/book The best way to predict the future is to help create it On 3/14/2014 3:21 PM, Byron Mann wrote: The default for the return format for a remote cffunction call is WDDX. Sounds like inside your CFC you are serializing the return value first. So something like return serializeJson(myValue); If the return string in this case is JSON, then your remote call to the CFC should include a returnformat=plain, to return the string as is. Byron Mann Lead Engineer Architect HostMySite.com On Fri, Mar 14, 2014 at 3:26 PM, Rixon Reed ri...@photoeye.com wrote: I have a CFC that I'm trying to return JSON data in a web service.=20 If I do a dump before I return the code to the calling program, the JSON is= fine. However it returns this to the calling program:[\\\n\\t\\n\\t\\t\\= n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\= t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\= t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio= \\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\= t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\= t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\= n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\= t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\= t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\= n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\= t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\\/category\\n\\t= \\t\\\/category\\n\\t\\\/category\\n\\t\\n\\t\\t\\n\\t\\t\\\/category= \\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\\/portfolio\\n\\t\\t\\n\\t\\t\\\/categor= y\\n\\t\\t\\n\\t\\t\\\/category\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\\/portfo= lio\\n\\t\\t\\n\\t\\t\\\/portfolio\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\t\\= n\\t\\t\\t\\t\\n\\t\\t\\t\\\/portfolio\\n\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\= t\\t\\t\\n\\t\\t\\t\\\/portfolio\\n\\t\\t\\\/category\\n\\t\\t\\n\\t\\t= \\\/portfolio\\n\\t\\\/category\\n\\t\\n\\t\\\/portfolio\\n\\t\\n\\t= \\\/portfolio\\n\\t\\n\\t\\\/portfolio\\n\\\/root\,\\\n\\t\\n\\t\\\= /category\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\= t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\\/portfolio\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\= \\/portfolio\\n\\t\\n\\t\\\/category\\n\\t\\n\\t\\\/category\\n\\\/ro= ot\] What am I doing wrong? Thanks in advance. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357938 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Array methods fail when working with Component Meta Data
Has anyone else run into this? The following code fails. The error message is: The ArrayAppend ColdFusion function is not supported on this object. The ArrayAppend ColdFusion function is not supported on an object of type coldfusion.runtime.Cast$1. For example, XML objects can be operated on by a subset of the structure and array functions, but not all. Sample Code: metaData = GetMetaData(someComponent); arrayOfFunctions = metaData.functions; ArrayAppend(arrayOfFunctions, same new value); Also fails if I do a Duplicate(). ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352685 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Array methods fail when working with Component Meta Data
May be worth mentioning that this works on Railo. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352686 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Array methods fail when working with Component Meta Data
Has anyone else run into this? metadata.functions is a java array rather than a CF array (ie java.util.List). Java arrays are immutable. You cannot change its dimensions by adding or removing elements. You must create your own copy manually. (FWIW CF10 will duplicate it, but the result is still an immutable java array) http://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html -Leig ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352687 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Array methods fail when working with Component Meta Data
May be worth mentioning that this works on Railo. Yep. It is because Railo stores the functions in a mutable object railo.runtime.type.ArrayImpl. But Adobe CF uses an immutable java.lang.Object[] array. -Leigh ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352694 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
struct/array problem with empty cells
Need a little assistance with a struct/array problem please! --- Data in question is coming from ONE row in the database. There are six fpcomm cells: fpcomm1,fpcomm2, ... and so on There are also six fpord cells: fpord1, fpord2, ... and so on So, I need to display the contents of the fpcomm cells, ordered by the integer in the fpord cells. My query is getNEWS. The below works great, and sorts the results as I need. cfset allNEWS = StructNew() cfloop from=1 to=6 index=i cfset oneSTORY = StructNew() cfset oneSTORY.cellID = #i# cfset oneSTORY.ord = #getNEWS[fpord#i#][1]# cfset oneSTORY.cell = #getNEWS[fpcomm#i#][1]# cfset allNEWS[oneSTORY.cell] = oneSTORY /cfloop cfset sortedKeys = StructSort(allNEWS, numeric, asc, ord) Here's the problem, maybe fpcomm5 and fpcomm6 are EMPTY (or NULL) on a particular day. REGARDLESS, I still need all six positions in sortedKeys returned. Let's say for the moment that fpcomm5 and fpcomm6 cells are empty. If I do a dump of sortedKeys, I'll get: array 1 Item One 2 Item Two 3 Something Else 4 Even Something Else 5 [empty string] It INCLUDES the first emtpy row (fpcomm5), but NOT fpcomm6, which looks exactly like fpcomm5 in the database. If fpcomm4, 5, and 6 are empty, it will include fpcomm4, but not 5 and 6. Weird - it only include the FIRST empty element I need the array to always include all six elements. [empty string] is exactly what I need - but I need ALL of them. Suggestions? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351660 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: struct/array problem with empty cells
Weird - it only include the FIRST empty element Actually, if there are duplicate values for any of the fpcomm cells, it will only display the FIRST one. So, if fpcomm1 and fpcomm2 contains Bob has News, it's only going to include fpcomm1 in the array. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351661 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Array conversion issue
Hi, Tom... Did you ever get something worked out for this? Rick Hello friends, I am trying (in Javascript an Coldfusion) to convert: {val1:member,val2:book,val3:journal,val4:new_member,val5: cds}, into this: { member,book,journal,new_member,cds} Notice that I am trying to eliminate quotes. Is it possible to achieve that? How can I do it? Thanks Tom ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351251 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Array conversion issue
Hello friends, I am trying (in Javascript an Coldfusion) to convert: {val1:member,val2:book,val3:journal,val4:new_member,val5:cds}, into this: { member,book,journal,new_member,cds} Notice that I am trying to eliminate quotes. Is it possible to achieve that? How can I do it? Thanks Tom ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351248 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Array conversion issue
Hello friends, I am trying (in Javascript an Coldfusion) to convert: {val1:member,val2:book,val3:journal,val4:new_member,val5:cds}, into this: { member,book,journal,new_member,cds} Notice that I am trying to eliminate quotes. Is it possible to achieve that? How can I do it? Thanks Tom ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351249 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Array conversion issue
Just use the replace function to remove all the quotes from the list. Regards Russ Michaels From my mobile On 18 May 2012 19:13, Tom Rigas rigasathanasio...@hotmail.com wrote: Hello friends, I am trying (in Javascript an Coldfusion) to convert: {val1:member,val2:book,val3:journal,val4:new_member,val5:cds}, into this: { member,book,journal,new_member,cds} Notice that I am trying to eliminate quotes. Is it possible to achieve that? How can I do it? Thanks Tom ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351250 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Array a directory name
How do you split a directory name into an array or remove a section from the name? Example dir = Internet/Manuals/tests/doc.html into newdir = tests/doc.html Thank you Keith ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350850 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Array a directory name
Did you try the listToArray function? On Fri, Apr 27, 2012 at 10:03 AM, Keith McGee kpmc...@frontiernet.net wrote: How do you split a directory name into an array or remove a section from the name? Example dir = Internet/Manuals/tests/doc.html into newdir = tests/doc.html Thank you Keith ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350851 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Array a directory name
I tried this cfset arr = listToArray (filename, /,false,true) received this error Parameter validation error for the LISTTOARRAY function. The function accepts 1 to 3 parameters. The error occurred in repositoryView.cfm: line 14 12 :cfif right(downloadFilename, 3) eq 'htm' 13 : 14 : cfset arr = listToArray (filename, /,false,true) ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350852 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Array a directory name
Um... so why did you provide 4 arguments? On Fri, Apr 27, 2012 at 10:11 AM, Keith McGee kpmc...@frontiernet.net wrote: I tried this cfset arr = listToArray (filename, /,false,true) received this error Parameter validation error for the LISTTOARRAY function. The function accepts 1 to 3 parameters. The error occurred in repositoryView.cfm: line 14 12 : cfif right(downloadFilename, 3) eq 'htm' 13 : 14 : cfset arr = listToArray (filename, /,false,true) ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350853 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Array a directory name
Oh - you were trying to include multichar delimiters. That was added in CF9. But you aren't using a multichar delim so you don't need it. On Fri, Apr 27, 2012 at 10:14 AM, Raymond Camden raymondcam...@gmail.com wrote: Um... so why did you provide 4 arguments? On Fri, Apr 27, 2012 at 10:11 AM, Keith McGee kpmc...@frontiernet.net wrote: I tried this cfset arr = listToArray (filename, /,false,true) received this error Parameter validation error for the LISTTOARRAY function. The function accepts 1 to 3 parameters. The error occurred in repositoryView.cfm: line 14 12 : cfif right(downloadFilename, 3) eq 'htm' 13 : 14 : cfset arr = listToArray (filename, /,false,true) ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350854 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Array a directory name
it says 1-3 params, and you have used 4. http://www.cfquickdocs.com/#ListToArray check the docs for your cf version, only cf9 support 4 params On Fri, Apr 27, 2012 at 4:11 PM, Keith McGee kpmc...@frontiernet.netwrote: I tried this cfset arr = listToArray (filename, /,false,true) received this error Parameter validation error for the LISTTOARRAY function. The function accepts 1 to 3 parameters. The error occurred in repositoryView.cfm: line 14 12 :cfif right(downloadFilename, 3) eq 'htm' 13 : 14 : cfset arr = listToArray (filename, /,false,true) ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350855 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Array a directory name
Ok that worked, I'm using cf8. If I use a comma or forward slash as a delimiter doesn't error. Now if you use a backslash as a delimiter I get this error Unexpected internal error near index 3 :|\ ^ The error occurred in repositoryView.cfm: line 14 12 :cfif right(downloadFilename, 3) eq 'htm' 13 : 14 : cfset arr = listToArray (filename, \,true) ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350856 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Array a directory name
Figured it out, Thank you guys ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350857 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Array a directory name
Remember that Windows and Linux do this differently. On Fri, Apr 27, 2012 at 11:06 AM, Raymond Camden raymondcam...@gmail.com wrote: Did you try the listToArray function? On Fri, Apr 27, 2012 at 10:03 AM, Keith McGee kpmc...@frontiernet.net wrote: How do you split a directory name into an array or remove a section from the name? Example dir = Internet/Manuals/tests/doc.html into newdir = tests/doc.html Thank you Keith ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350858 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Array a directory name
newdir = tests/doc.html According to the example you give, what you're looking for is not an array but a substring. How about newdir = listGetAt(dir, listLen(dir, /)-1, /) / listLast(dir, /) ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350859 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Array a directory name
If your example represents the exact scenario in all cases, I'd probably just use GetFileFromPath() and GetDirectoryFromPath(), in conjunction with ListLast(): !--- Where OldDir = Internet/Manuals/tests/doc.html --- cfset NewDir = #ListLast(GetDirectoryFromPath(OldDir),'/')#/#GetFileFromPath(OldDir)# -Christopher How do you split a directory name into an array or remove a section from the name? Example dir = Internet/Manuals/tests/doc.html into newdir = tests/doc.html Thank you Keith ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350861 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
How to delete a row in a 2 dimensional array
I have created a 2D array. When I delete an row the elements disappear but not the row itself which is causing problems. See the example below where Row 5 does not have any elements and is labeled empty. array 1 array 1 90 2 GOLDE 2 array 1 186 2 natural 3 array 1 302 2 Winchester 4 array 1 301 2 natural 5 array [empty] Here is the code I am using. It deletes the elements in in the row but not the row itself. Any help is greatly appreciated: cfoutput CFPARAM NAME=DeleteRow DEFAULT= CFPARAM NAME=ID DEFAULT=URL.ID CFLOOP INDEX = OuterCounter FROM= 1 TO =#ArrayLen(Session.samplecart)# CFIF Session.samplecart[OuterCounter][1] EQ #id# CFSET DeleteRow = #OuterCounter# #ArrayDeleteAt(Session.samplecart,DeleteRow)# /CFIF /CFLOOP /cfoutput ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350656 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How to delete a row in a 2 dimensional array
You are close but are missing a few basics there... Check out http://www.protonarts.com/0176120040217.pdf On Thu, Apr 5, 2012 at 8:16 PM, Marcia Fitzmaurice mar...@fitzwebdesigns.com wrote: I have created a 2D array. When I delete an row the elements disappear but not the row itself which is causing problems. See the example below where Row 5 does not have any elements and is labeled empty. array 1 array 1 90 2 GOLDE 2 array 1 186 2 natural 3 array 1 302 2 Winchester 4 array 1 301 2 natural 5 array [empty] Here is the code I am using. It deletes the elements in in the row but not the row itself. Any help is greatly appreciated: cfoutput CFPARAM NAME=DeleteRow DEFAULT= CFPARAM NAME=ID DEFAULT=URL.ID CFLOOP INDEX = OuterCounter FROM= 1 TO =#ArrayLen(Session.samplecart)# CFIF Session.samplecart[OuterCounter][1] EQ #id# CFSET DeleteRow = #OuterCounter# #ArrayDeleteAt(Session.samplecart,DeleteRow)# /CFIF /CFLOOP /cfoutput ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350657 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How to delete a row in a 2 dimensional array
You are close but are missing a few basics there... Check out http://www.protonarts.com/0176120040217.pdf On Thu, Apr 5, 2012 at 8:16 PM, Marcia Fitzmaurice mar...@fitzwebdesigns.com wrote: ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350658 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How to delete a row in a 2 dimensional array
You are close but are missing a few basics there... Check out http://www.protonarts.com/0176120040217.pdf On Thu, Apr 5, 2012 at 8:16 PM, Marcia Fitzmaurice mar...@fitzwebdesigns.com wrote: The PDF stops just before explaining how to do the delete. Any other suggestions? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350659 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Sorting Multidimensional Array that contain dates
I got this array CFSET temp = ArrayNew(1) CFSET temp[1][1] = 5/1/2011 CFSET temp[1][2] = Sally CFSET temp[2][1] = 3/4/2011 CFSET temp[2][2] = John How do I sort this array so that the John on 3/4/2011 is first in the array? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348196 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Sorting Multidimensional Array that contain dates
http://www.cflib.org/udf/ArraySort2D =] On Mon, Oct 17, 2011 at 2:45 PM, Rick T rtuinenb...@gmail.com wrote: I got this array CFSET temp = ArrayNew(1) CFSET temp[1][1] = 5/1/2011 CFSET temp[1][2] = Sally CFSET temp[2][1] = 3/4/2011 CFSET temp[2][2] = John How do I sort this array so that the John on 3/4/2011 is first in the array? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348197 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Sorting Multidimensional Array that contain dates
Thanks Alan that worked, here is the final code that made it work for my situation: cfscript /** * Sorts a two dimensional array by the specified column in the second dimension. * * @return Returns an array. * @author Robert West (robert.w...@digiphilic.com) * @version 1, October 8, 2002 */ function ArraySort2D(arrayToSort, sortColumn, type) { var order = asc; var i = 1; var j = 1; var thePosition = ; var theList = ; var arrayToReturn = ArrayNew(2); var sortArray = ArrayNew(1); var counter = 1; if (ArrayLen(Arguments) GT 3){ order = Arguments[4]; } for (i=1; i LTE ArrayLen(arrayToSort); i=i+1) { ArrayAppend(sortArray, arrayToSort[i][sortColumn]); } theList = ArrayToList(sortArray); ArraySort(sortArray, type, order); for (i=1; i LTE ArrayLen(sortArray); i=i+1) { thePosition = ListFind(theList, sortArray[i]); theList = ListDeleteAt(theList, thePosition); for (j=1; j LTE ArrayLen(arrayToSort[thePosition]); j=j+1) { arrayToReturn[counter][j] = arrayToSort[thePosition][j]; } ArrayDeleteAt(arrayToSort, thePosition); counter = counter + 1; } return arrayToReturn; } /cfscript cfset startArray = ArrayNew(2) cfset startArray[1][1] = 11/10/11 cfset startArray[1][2] = hello cfset startArray[2][1] = 12/5/11 cfset startArray[2][2] = cool cfset startArray[3][1] = 1/4/11 cfset startArray[3][2] = nice cfoutput cfloop from=1 to=#ArrayLen(startArray)# index=i cfloop from=1 to=#ArrayLen(startArray[i])# index=j startArray[#i#][#j#] is #startArray[i][j]#br/cfloop /cfloop /p cfset finalArray = #ArraySort2D(startArray, 1, numeric)# p cfloop from=1 to=#ArrayLen(finalArray)# index=i cfloop from=1 to=#ArrayLen(finalArray[i])# index=j finalArray[#i#][#j#] is #finalArray[i][j]#br /cfloop /cfloop /p /cfoutput ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348198 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Append JSON into an Array
Can anyone see what I am doing wrong with this code? I get a Missing argument name response. cfset local = {} / cfset local.fields = structNew() cfscript local.fields.member = arraynew(1); arrayappend(local.fields.member, {name:broker_id, value:Broker ID}); arrayappend(local.fields.member, {name:memberid, value:Member ID}); /cfscript Thanks Steve ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346158 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Append JSON into an Array
That's not how you do implicit structs in CF. You need to use key=name instead. arrayappend(local.fields.member, {name=broker_id, value=Broker ID}); arrayappend(local.fields.member, {name=memberid, value=Member ID}); On Fri, Jul 8, 2011 at 1:27 PM, Steven Jaeger st...@enrollment123.com wrote: Can anyone see what I am doing wrong with this code? I get a Missing argument name response. cfset local = {} / cfset local.fields = structNew() cfscript local.fields.member = arraynew(1); arrayappend(local.fields.member, {name:broker_id, value:Broker ID}); arrayappend(local.fields.member, {name:memberid, value:Member ID}); /cfscript Thanks Steve ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346159 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Append JSON into an Array
I get a Missing argument name response. Perhaps CF sees {} and thinks you are trying to create a CF structure? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346160 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Append JSON into an Array
Yeah, what that guy said ... ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346161 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Append JSON into an Array
Worked like a charm. Thank you much! On Jul 8, 2011, at 11:38 AM, Raymond Camden wrote: That's not how you do implicit structs in CF. You need to use key=name instead. arrayappend(local.fields.member, {name=broker_id, value=Broker ID}); arrayappend(local.fields.member, {name=memberid, value=Member ID}); On Fri, Jul 8, 2011 at 1:27 PM, Steven Jaeger st...@enrollment123.com wrote: Can anyone see what I am doing wrong with this code? I get a Missing argument name response. cfset local = {} / cfset local.fields = structNew() cfscript local.fields.member = arraynew(1); arrayappend(local.fields.member, {name:broker_id, value:Broker ID}); arrayappend(local.fields.member, {name:memberid, value:Member ID}); /cfscript Thanks Steve ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346162 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
coldfusion array to javascript via ajax
hi i am thinking the solution to this is staring me in the face but cannot seem to work it out! I am making a call to the server via ext.ajax.request and i want the server to pass back an array for javascript to use. I am currently passing the array back using SerializeJSON(theArray), however in JS if i use the Ext.util.JSON.decode(result.theArray); it is not turning it back into an array... it just prints a string '[1,2,3]' i have tried the alternative arrayToJSON function (which is part of the toJSON library) but JS recieves the array and prints it as: {data:[data:1,data:2,data:3]} and i dont have a clue how to convert that back into a javascript array of '1,2,3' would appreciate any help, thanks ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342923 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: coldfusion array to javascript via ajax
i used eval() in javascript and now works fine! ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342930 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
CF8: Nested Array loop in a Query loop
I'm having an issue with the cfloop only looping once. Here's a sudo code of whats going on: cfloop query=table cfloop from=1 to=4 index=listValue !--- looping over an array then resetting a value of a veriable --- /cfloop /cfloop Using a CFdump it appears that the inner loop is only running once, while the outter loop is outputting 20-30 different pieces of data (expected). How can I fix? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342528 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF8: Nested Array loop in a Query loop
Here's a bit of the code if you need to see it. !--- Setting an array of date ranges --- cfset validDateRange=ArrayNew(1) cfset ArrayAppend(validDateRange, 0) !--- Index 1 --- cfset ArrayAppend(validDateRange, 15) !--- Index 2 --- cfset ArrayAppend(validDateRange, 30) !--- Index 3 --- cfset ArrayAppend(validDateRange, 60) !--- Index 4 --- cfset ArrayAppend(validDateRange, 90) !--- Index 5 --- !--- Defining an empty class for our table row --- cfset daySet= !--- a Continue(); function; setting a default value of false --- cfset continueL=false !--- The loop that dumps the database --- cfloop query=certs cfoutput cfloop from=1 to=4 index=listValue !--- has this row already been run? a sort of Coldfusion Continue(); --- !--- cfif continueL EQ False --- !--- EXPIRES IN x days but greater then y --- !--- Does expire in x days but not less then y? --- cfif ((adultExp gt validDateRange[listValue]) AND (adultExp LTE validDateRange[listValue+1])) OR ((kidExp gt validDateRange[listValue]) AND (kidExp LTE validDateRange[listValue+1]) ) OR ((frpExp gt validDateRange[listValue]) AND (frpExp LTE validDateRange[listValue+1])) OR ((aExp gt validDateRange[listValue]) AND (aExp LTE validDateRange[listValue+1])) OR ((aidExp gt validDateRange[listValue]) AND (aidExp LTE validDateRange[listValue+1])) OR ((eExp gt validDateRange[listValue]) AND (eExp LTE validDateRange[listValue+1])) OR ((waterExpt gt validDateRange[listValue]) AND (waterExpt LTE validDateRange[listValue+1])) OR ((bloodExp gt validDateRange[listValue]) AND (bloodExp LTE validDateRange[listValue+1])) OR ((oxyExp gt validDateRange[listValue]) AND (oxyExp LTE validDateRange[listValue+1])) OR ((lifeExp gt validDateRange[listValue]) AND (lifeExp LTE validDateRange[listValue+1])) OR ((wildExp gt validDateRange[listValue]) AND (wildExp LTE validDateRange[listValue+1])) cfswitch expression=#validDateRange[listValue]# cfcase value=0 cfset daySet=class='tr15' cfset continueL=true/cfcase cfcase value=15 cfset daySet=class='tr30' cfset continueL=true/cfcase cfcase value=30 cfset daySet=class='tr60' cfset continueL=true/cfcase cfcase value=60 cfset daySet=class='tr90' cfset continueL=true/cfcase cfdefaultcase cfset daySet= cfset continueL=true/cfdefaultcase /cfswitch !--- If it's true it returns to the loop with the #daySet# veriable and we use that to define the class -- That way if it's false it's a simple TR, but if it's true we get a class style --- !--- Code has been run time to set to true an go to the next row --- cfset continueL=true /cfif !--- Closing the date loop, inner --- !---/cfif---!--- End Continue(); --- /cfloop!--- Ends the array loop --- !--- a Continue(); function --- cfset continueL=false tr #daySet# !--- lots of table data output, then we close --- ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342529 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF8: Nested Array loop in a Query loop
It appears that you don't have any code that runs if any of these conditions are false: cfif ((adultExp gt validDateRange[listValue]) AND (adultExp LTE validDateRange[listValue+1])) OR ((kidExp gt validDateRange[listValue]) AND (kidExp LTE validDateRange[listValue+1]) ) OR ((frpExp gt validDateRange[listValue]) AND (frpExp LTE validDateRange[listValue+1])) OR ((aExp gt validDateRange[listValue]) AND (aExp LTE validDateRange[listValue+1])) OR ((aidExp gt validDateRange[listValue]) AND (aidExp LTE validDateRange[listValue+1])) OR ((eExp gt validDateRange[listValue]) AND (eExp LTE validDateRange[listValue+1])) OR ((waterExpt gt validDateRange[listValue]) AND (waterExpt LTE validDateRange[listValue+1])) OR ((bloodExp gt validDateRange[listValue]) AND (bloodExp LTE validDateRange[listValue+1])) OR ((oxyExp gt validDateRange[listValue]) AND (oxyExp LTE validDateRange[listValue+1])) OR ((lifeExp gt validDateRange[listValue]) AND (lifeExp LTE validDateRange[listValue+1])) OR ((wildExp gt validDateRange[listValue]) AND (wildExp LTE validDateRange[listValue+1])) Is it possible that all these conditions are true only once per query loop iteration? Why not push some output to the screen if the above condition evaluates to false to see if that's the case? On Wed, Feb 23, 2011 at 12:38 PM, Adam Bourg adam.bo...@gmail.com wrote: Here's a bit of the code if you need to see it. !--- Setting an array of date ranges --- cfset validDateRange=ArrayNew(1) cfset ArrayAppend(validDateRange, 0) !--- Index 1 --- cfset ArrayAppend(validDateRange, 15) !--- Index 2 --- cfset ArrayAppend(validDateRange, 30) !--- Index 3 --- cfset ArrayAppend(validDateRange, 60) !--- Index 4 --- cfset ArrayAppend(validDateRange, 90) !--- Index 5 --- !--- Defining an empty class for our table row --- cfset daySet= !--- a Continue(); function; setting a default value of false --- cfset continueL=false !--- The loop that dumps the database --- cfloop query=certs cfoutput cfloop from=1 to=4 index=listValue !--- has this row already been run? a sort of Coldfusion Continue(); --- !--- cfif continueL EQ False --- !--- EXPIRES IN x days but greater then y --- !--- Does expire in x days but not less then y? --- cfif ((adultExp gt validDateRange[listValue]) AND (adultExp LTE validDateRange[listValue+1])) OR ((kidExp gt validDateRange[listValue]) AND (kidExp LTE validDateRange[listValue+1]) ) OR ((frpExp gt validDateRange[listValue]) AND (frpExp LTE validDateRange[listValue+1])) OR ((aExp gt validDateRange[listValue]) AND (aExp LTE validDateRange[listValue+1])) OR ((aidExp gt validDateRange[listValue]) AND (aidExp LTE validDateRange[listValue+1])) OR ((eExp gt validDateRange[listValue]) AND (eExp LTE validDateRange[listValue+1])) OR ((waterExpt gt validDateRange[listValue]) AND (waterExpt LTE validDateRange[listValue+1])) OR ((bloodExp gt validDateRange[listValue]) AND (bloodExp LTE validDateRange[listValue+1])) OR ((oxyExp gt validDateRange[listValue]) AND (oxyExp LTE validDateRange[listValue+1])) OR ((lifeExp gt validDateRange[listValue]) AND (lifeExp LTE validDateRange[listValue+1])) OR ((wildExp gt validDateRange[listValue]) AND (wildExp LTE validDateRange[listValue+1])) cfswitch expression=#validDateRange[listValue]# cfcase value=0 cfset daySet=class='tr15' cfset continueL=true/cfcase cfcase value=15 cfset daySet=class='tr30' cfset continueL=true/cfcase cfcase value=30 cfset daySet=class='tr60' cfset continueL=true/cfcase cfcase value=60 cfset daySet=class='tr90' cfset continueL=true/cfcase cfdefaultcase cfset daySet= cfset continueL=true/cfdefaultcase /cfswitch !--- If it's true it returns to the loop with the #daySet# veriable and we use that to define the class -- That way if it's false it's a simple TR, but if it's true we get a class style --- !--- Code has been run time to set to true an go to the next row --- cfset continueL=true /cfif !--- Closing the date loop, inner --- !---/cfif---!--- End Continue(); --- /cfloop!--- Ends the array loop --- !--- a Continue(); function --- cfset continueL=false tr #daySet# !--- lots of table data output, then we close --- ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid
Re: Coldfusion Array/List questions
What about: cfset myArray = [{name:'col1', index:'col1', sorttype:'string'},{name:'col2', index:'col2', sorttype:'string'},{name:'col3', index:'col3', sorttype:'string'}] / On Thu, Jan 6, 2011 at 1:01 PM, fun and learning funandlrnn...@gmail.comwrote: Hi All- I am trying to build a list with following values: cfset list = {name:'col1', index:'col1', sorttype:'string'},{name:'col2', index:'col2', sorttype:'string'},{name:'col3', index:'col3', sorttype:'string'} So the above list has 3 values with each value enclosed within the brackets. When i convert it into array, am getting back 18 values as it is counting each attribute in the value. How can I make it to consider them as 3 values? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340621 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Coldfusion Array/List questions
Hi All- I am trying to build a list with following values: cfset list = {name:'col1', index:'col1', sorttype:'string'},{name:'col2', index:'col2', sorttype:'string'},{name:'col3', index:'col3', sorttype:'string'} So the above list has 3 values with each value enclosed within the brackets. When i convert it into array, am getting back 18 values as it is counting each attribute in the value. How can I make it to consider them as 3 values? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340522 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Coldfusion Array/List questions
listtoarray(list,},{) I believe will work. On Thu, Jan 6, 2011 at 1:01 PM, fun and learning funandlrnn...@gmail.comwrote: Hi All- I am trying to build a list with following values: cfset list = {name:'col1', index:'col1', sorttype:'string'},{name:'col2', index:'col2', sorttype:'string'},{name:'col3', index:'col3', sorttype:'string'} So the above list has 3 values with each value enclosed within the brackets. When i convert it into array, am getting back 18 values as it is counting each attribute in the value. How can I make it to consider them as 3 values? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340524 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Coldfusion Array/List questions
So the above list has 3 values with each value enclosed within the brackets. ColdFusion doesn't know that and is seeing ALL of the commas as list delimiters. You'll need to change the delimiter to something else and then break it apart: cfset list = {x,x,x},{x,x,x},{x,x,x} / cfset list = replace(list, },{, }#chr(255){ / cfset theArray = listToArray(list, chr(255)) / What we're doing here is changing the desired delimited (between the closing and opening brackets) to some other unused character (ascii 255 in this case) and then using that as the delimiter for the break, ignoring the commas entirely. -Justin ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340526 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Coldfusion Array/List questions
So the above list has 3 values with each value enclosed within the brackets. ColdFusion doesn't know that and is seeing ALL of the commas as list delimiters. You'll need to change the delimiter to something else and then break it apart: cfset list = {x,x,x},{x,x,x},{x,x,x} / cfset list = replace(list, },{, }#chr(255){ / cfset theArray = listToArray(list, chr(255)) / What we're doing here is changing the desired delimited (between the closing and opening brackets) to some other unused character (ascii 255 in this case) and then using that as the delimiter for the break, ignoring the commas entirely. -Justin Thanks for replying. I get other problem now. The above list is converted as below: cfset list = {name:'col1', index:'col1', sorttype:'string'},{name:'col2', index:'col2', sorttype:'string'},{name:'col3', index:'col3', sorttype:'string'} Each name:value is getting surrounded by double quotes. How to ignore these? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340529 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Diplaying struct info when you dump an array with strcts in it's elements...
Is there a way to get cfdump to display the struct name when it dumps? I have an array that contains a struct and I am having some issues adding some vars for display so I want to make sure I am addressing it correctly. Currently, all cfdump shows is the word struct. It looks like everything is addressed properly, but I am getting errors saying that the vars aren't defined. I am learning a new application (new position) so I am immersed in a rather steep learning curve at the moment while trying to get stuff done that needs to be done next week :-D Nothing like hitting the ground running! Eric ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340270 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Diplaying struct info when you dump an array with strcts in it's elements...
You can add the label attribute? cfdump var=#myStruct1# label=myStruct1 / cfdump var=#myOtherStruct# label=a different struct / On Fri, Dec 24, 2010 at 6:21 PM, Eric Roberts ow...@threeravensconsulting.com wrote: Is there a way to get cfdump to display the struct name when it dumps? I have an array that contains a struct and I am having some issues adding some vars for display so I want to make sure I am addressing it correctly. Currently, all cfdump shows is the word struct. It looks like everything is addressed properly, but I am getting errors saying that the vars aren't defined. I am learning a new application (new position) so I am immersed in a rather steep learning curve at the moment while trying to get stuff done that needs to be done next week :-D Nothing like hitting the ground running! Eric ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340271 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Diplaying struct info when you dump an array with strcts in it's elements...
Any way to ge that dynamically label structures instead of just putting array or struct? -Original Message- From: Charlie Griefer [mailto:charlie.grie...@gmail.com] Sent: Friday, December 24, 2010 19:51 To: cf-talk Subject: Re: Diplaying struct info when you dump an array with strcts in it's elements... You can add the label attribute? cfdump var=#myStruct1# label=myStruct1 / cfdump var=#myOtherStruct# label=a different struct / On Fri, Dec 24, 2010 at 6:21 PM, Eric Roberts ow...@threeravensconsulting.com wrote: Is there a way to get cfdump to display the struct name when it dumps? I have an array that contains a struct and I am having some issues adding some vars for display so I want to make sure I am addressing it correctly. Currently, all cfdump shows is the word struct. It looks like everything is addressed properly, but I am getting errors saying that the vars aren't defined. I am learning a new application (new position) so I am immersed in a rather steep learning curve at the moment while trying to get stuff done that needs to be done next week :-D Nothing like hitting the ground running! Eric ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340272 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Diplaying struct info when you dump an array with strcts in it's elements...
The value for label can be any value you want... literal string or variable. On Fri, Dec 24, 2010 at 7:33 PM, Eric Roberts ow...@threeravensconsulting.com wrote: Any way to ge that dynamically label structures instead of just putting array or struct? -Original Message- From: Charlie Griefer [mailto:charlie.grie...@gmail.com] Sent: Friday, December 24, 2010 19:51 To: cf-talk Subject: Re: Diplaying struct info when you dump an array with strcts in it's elements... You can add the label attribute? cfdump var=#myStruct1# label=myStruct1 / cfdump var=#myOtherStruct# label=a different struct / On Fri, Dec 24, 2010 at 6:21 PM, Eric Roberts ow...@threeravensconsulting.com wrote: Is there a way to get cfdump to display the struct name when it dumps? I have an array that contains a struct and I am having some issues adding some vars for display so I want to make sure I am addressing it correctly. Currently, all cfdump shows is the word struct. It looks like everything is addressed properly, but I am getting errors saying that the vars aren't defined. I am learning a new application (new position) so I am immersed in a rather steep learning curve at the moment while trying to get stuff done that needs to be done next week :-D Nothing like hitting the ground running! Eric ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340273 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
returning an array from a query
hi . I have written a cfc which has a function which has a query and I want the result of that query to be returned as an array and I have specified the return type of the function to Array . I hope I can then use that Array in my Flex application . but I can't return the right value and CF gives me error . my cfc is as follow: cfcomponent cfprocessingdirective pageencoding=utf-8 cfset setEncoding(form,utf-8) cfset setEncoding(url,utf-8) cfcontent type=text/html ; charset=UTF-8 cffunction name=login access=remote returntype=Array cfargument name=username type=string required=true cfargument name=password type=string required=true cfquery name=qCheck datasource=Library select username,password from Users where username=cfqueryparam value=#username# cfsqltype=cf_sql_varchar AND password=cfqueryparam value=#password# cfsqltype=cf_sql_varchar cfreturn qCheck /cffunction /cfcontent /cfcomponent -- I'll be appreciated if you can help me with this . thanks . ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:339204 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
returning an array from a query
hi . I have written a cfc which has a function which has a query and I want the result of that query to be returned as an array and I have specified the return type of the function to Array . I hope I can then use that Array in my Flex application . but I can't return the right value and CF gives me error . my cfc is as follow: cfcomponent cfprocessingdirective pageencoding=utf-8 cfset setEncoding(form,utf-8) cfset setEncoding(url,utf-8) cfcontent type=text/html ; charset=UTF-8 cffunction name=login access=remote returntype=Array cfargument name=username type=string required=true cfargument name=password type=string required=true cfquery name=qCheck datasource=Library select username,password from Users where username=cfqueryparam value=#username# cfsqltype=cf_sql_varchar AND password=cfqueryparam value=#password# cfsqltype=cf_sql_varchar cfreturn qCheck /cffunction /cfcontent /cfcomponent -- I'll be appreciated if you can help me with this . thanks . ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:339205 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: returning an array from a query
You need to loop over the query result and build the array to return. Something like so... ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:339207 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: returning an array from a query
I don't know if you realise, but you can actually treat a query an an associative array anyway, you do not need to do any conversion to do this. The syntax is Query['column'][row] Might save you some work -- Russ Michaels http://www.bluethunderinternet.com : B2B hosting, VPS's, Exchange, CF, Railo www.cfmldeveloper.com : CFML community, FREE ColdFusion/Railo hosting http://www.michaels.me.uk : My Blog skype me : russmichaels ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:339208 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: returning an array from a query
I don't use Flex, but wouldn't that still appear to Flex as an invalid data type (e.g. not an array)? But yes, in CF, most certainly use that syntax. :-) ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:339209 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: returning an array from a query [spamtrap bayes][spamtrap heur]
On 11/15/2010 2:10 AM, mojtaba tabatabaie wrote: cfset setEncoding(form,utf-8) cfset setEncoding(url,utf-8) these aren't required in your CFC. just return the query to flex use something like this in your event handler: private function streamsResultHandler(event:ResultEvent):void { streams=event.result as ArrayCollection; } or are you using some kind of typed object in flex? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:339222 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Array Error
Hi All - I am trying to do the following in my code. cfquery datasource=cfflex name=q SELECT t1.account_id FROM accounts1 AS t1 LEFT JOIN accounts1 as t2 ON t1.account_id = t2.parent_id WHERE t2.account_id IS NULL /cfquery cfset treeData = arrayNew(1) / cfset vleafnodes = arrayNew(1) / cfloop query=q cfset vleafnodes[q.account_id] = q.account_id /cfloop cfquery name=getRec datasource=cfflex SELECT account_id, name, acc_num, debit, credit, balance, parent_id FROM accounts1 WHERE ... /cfquery cfloop query=getRec cfif getRec.account_id EQ vleafnodes[getRec.account_id] cfset vLeaf = true cfelse cfset vLeaf = false /cfif /cfloop The array for the vleafnodes looks like below: array 1 [undefined array element] Element 1 is undefined in a Java object of type class coldfusion.runtime.Array. 2 [undefined array element] Element 2 is undefined in a Java object of type class coldfusion.runtime.Array. 3 3 4 4 5 [undefined array element] Element 5 is undefined in a Java object of type class coldfusion.runtime.Array. 6 6 7 7 8 8 using isdefined or isarray to check if the element is defined in a particular position is not helping during the comparision statement cfif getRec.account_id EQ vleafnodes[getRec.account_id] I keep getting the following error Element 1 is undefined in a Java object of type class coldfusion.runtime.Array. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338042 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Array Error
Try this... cfloop query=q cfscript ArrayAppend(vleafnodes, q.account_id); /cfscript /cfloop However this is not going to give you the ability to reference the array element by the account ID, it sounds like what you want is a structure. cfloop query=q cfscript StructInsert(myLeafStruct, q.account_id, q.account_id, true); /cfscript /cfloop This will allow you to reference the account if by the query id. Regards, David McGraw Oyova Software, LLC http://www.oyova.com Hi All - I am trying to do the following in my code. cfquery datasource=cfflex name=q SELECT t1.account_id FROM accounts1 AS t1 LEFT JOIN accounts1 as t2 ON t1.account_id = t2.parent_id WHERE t2.account_id IS NULL /cfquery cfset treeData = arrayNew(1) / cfset vleafnodes = arrayNew(1) / cfloop query=q cfset vleafnodes[q.account_id] = q.account_id /cfloop cfquery name=getRec datasource=cfflex SELECT account_id, name, acc_num, debit, credit, balance, parent_id FROM accounts1 WHERE ... /cfquery cfloop query=getRec cfif getRec.account_id EQ vleafnodes[getRec.account_id] cfset vLeaf = true cfelse cfset vLeaf = false /cfif /cfloop The array for the vleafnodes looks like below: array 1 [undefined array element] Element 1 is undefined in a Java object of type class coldfusion.runtime.Array. 2 [undefined array element] Element 2 is undefined in a Java object of type class coldfusion.runtime.Array. 3 3 4 4 5 [undefined array element] Element 5 is undefined in a Java object of type class coldfusion.runtime.Array. 6 6 7 7 8 8 using isdefined or isarray to check if the element is defined in a particular position is not helping during the comparision statement cfif getRec.account_id EQ vleafnodes[getRec.account_id] I keep getting the following error Element 1 is undefined in a Java object of type class coldfusion. runtime.Array. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338043 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Array Error
You'll need to use a struct to do your bidding instead of an array-- I don't think you can skip values in arrays, so if your query is returning account_ids 1,2,4,5, #3 would fail. maybe something like... cfquery datasource=cfflex name=q SELECT t1.account_id FROM accounts1 AS t1 LEFT JOIN accounts1 as t2 ON t1.account_id = t2.parent_id WHERE t2.account_id IS NULL /cfquery cfset treeData = structNew() / cfset vleafnodes = arrayNew() / cfloop query=q cfset vleafnodes[q.account_id] = q.account_id /cfloop cfquery name=getRec datasource=cfflex SELECT account_id, name, acc_num, debit, credit, balance, parent_id FROM accounts1 WHERE ... /cfquery cfloop query=getRec cfset vLeaf = false cfif structKeyExists(vleafnodes, getRec.account_id) cfset vLeaf = true /cfif /cfloop Hi All - I am trying to do the following in my code. cfquery datasource=cfflex name=q SELECT t1.account_id FROM accounts1 AS t1 LEFT JOIN accounts1 as t2 ON t1.account_id = t2.parent_id WHERE t2.account_id IS NULL /cfquery cfset treeData = arrayNew(1) / cfset vleafnodes = arrayNew(1) / cfloop query=q cfset vleafnodes[q.account_id] = q.account_id /cfloop cfquery name=getRec datasource=cfflex SELECT account_id, name, acc_num, debit, credit, balance, parent_id FROM accounts1 WHERE ... /cfquery cfloop query=getRec cfif getRec.account_id EQ vleafnodes[getRec.account_id] cfset vLeaf = true cfelse cfset vLeaf = false /cfif /cfloop The array for the vleafnodes looks like below: array 1 [undefined array element] Element 1 is undefined in a Java object of type class coldfusion.runtime.Array. 2 [undefined array element] Element 2 is undefined in a Java object of type class coldfusion.runtime.Array. 3 3 4 4 5 [undefined array element] Element 5 is undefined in a Java object of type class coldfusion.runtime.Array. 6 6 7 7 8 8 using isdefined or isarray to check if the element is defined in a particular position is not helping during the comparision statement cfif getRec.account_id EQ vleafnodes[getRec.account_id] I keep getting the following error Element 1 is undefined in a Java object of type class coldfusion. runtime.Array. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338045 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Array Error
Hi All - I am trying to do the following in my code. cfquery datasource=cfflex name=q SELECT t1.account_id FROM accounts1 AS t1 LEFT JOIN accounts1 as t2 ON t1.account_id = t2.parent_id WHERE t2.account_id IS NULL /cfquery cfset treeData = arrayNew(1) / cfset vleafnodes = arrayNew(1) / cfloop query=q cfset vleafnodes[q.account_id] = q.account_id /cfloop cfquery name=getRec datasource=cfflex SELECT account_id, name, acc_num, debit, credit, balance, parent_id FROM accounts1 WHERE ... /cfquery cfloop query=getRec cfif getRec.account_id EQ vleafnodes[getRec.account_id] cfset vLeaf = true cfelse cfset vLeaf = false /cfif /cfloop The array for the vleafnodes looks like below: array 1 [undefined array element] Element 1 is undefined in a Java object of type class coldfusion.runtime.Array. 2 [undefined array element] Element 2 is undefined in a Java object of type class coldfusion.runtime.Array. 3 3 4 4 5 [undefined array element] Element 5 is undefined in a Java object of type class coldfusion.runtime.Array. 6 6 7 7 8 8 using isdefined or isarray to check if the element is defined in a particular position is not helping during the comparision statement cfif getRec.account_id EQ vleafnodes[getRec.account_id] I keep getting the following error Element 1 is undefined in a Java object of type class coldfusion. runtime.Array. Thank you. That helped ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338047 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Any way to prevent storing methods inside of an array
It sounds like creating some sort of 'collection' component may solve your problem. So, instead of having an array of objects available to the application at large, you have a collection object that contains the array as a private property plus a method for returning a read only form of those objects (such as a query). I've only skimmed the answers here so apologies if this is way off. HTH Dominic On 6 October 2010 17:47, Judah McAuley ju...@wiredotter.com wrote: Thank you Dave, that was very succinct and helpful. Cheers, Judah On Wed, Oct 6, 2010 at 9:03 AM, Dave Watts dwa...@figleaf.com wrote: Matt, do you know of a good rundown on the difference between This and Variables scope in a CFC? I have a basic understanding of it but it is always been something I wanted to make sure I understood the fine distinctions in, kind of like the difference between var scoped variables and the local scope in CF9. The this scope makes variables public, and they can be read and written directly from outside the component, which breaks any validation that you might have to control their values within the component. The variables scope does not make them public. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337933 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Any way to prevent storing methods inside of an array
I spent some time trying to expose the methods in different structures with different access layers and it looks like the methods will not show up (as a structure) when returning out as json, web service or any other remote call. So basically, I was concerned that creating instances of objects could pass information about the methods within a cfc (like which ones are remote and what arguments would be accepted) but the only way to get this information is through public or private method calls, in which case it needs to be embedded inside of a coldfusion template after the cfc has been initiated. Does this all seem correct? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337939 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Any way to prevent storing methods inside of an array
Well, I still don't really understand what you're concerned about. If you have remote methods, you can see them via WSDL - that's kind of the whole point: it's a remotely accessible API. On Thu, Oct 7, 2010 at 10:52 AM, Tony Bentley cascadefreehee...@gmail.com wrote: I spent some time trying to expose the methods in different structures with different access layers and it looks like the methods will not show up (as a structure) when returning out as json, web service or any other remote call. So basically, I was concerned that creating instances of objects could pass information about the methods within a cfc (like which ones are remote and what arguments would be accepted) but the only way to get this information is through public or private method calls, in which case it needs to be embedded inside of a coldfusion template after the cfc has been initiated. Does this all seem correct? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337941 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Any way to prevent storing methods inside of an array
Matt, do you know of a good rundown on the difference between This and Variables scope in a CFC? I have a basic understanding of it but it is always been something I wanted to make sure I understood the fine distinctions in, kind of like the difference between var scoped variables and the local scope in CF9. The this scope makes variables public, and they can be read and written directly from outside the component, which breaks any validation that you might have to control their values within the component. The variables scope does not make them public. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337904 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Any way to prevent storing methods inside of an array
Objects have methods. If you store objects, they still have methods. Why do you think this could be a problem? You haven't explained what you're trying to do and *why* you think having the methods callable is... anything other than expected behavior. Sorry if I'm not being very helpful but I just can't get my head around where you're coming from on this... I can only echo what Sean said. I didn't answer the original post because I couldn't even figure out what the problem was. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337905 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Any way to prevent storing methods inside of an array
Okay, let me come up with something that would explain my situation better. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337908 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Any way to prevent storing methods inside of an array
Thank you Dave, that was very succinct and helpful. Cheers, Judah On Wed, Oct 6, 2010 at 9:03 AM, Dave Watts dwa...@figleaf.com wrote: Matt, do you know of a good rundown on the difference between This and Variables scope in a CFC? I have a basic understanding of it but it is always been something I wanted to make sure I understood the fine distinctions in, kind of like the difference between var scoped variables and the local scope in CF9. The this scope makes variables public, and they can be read and written directly from outside the component, which breaks any validation that you might have to control their values within the component. The variables scope does not make them public. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337911 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Any way to prevent storing methods inside of an array
I have a cfc that gets instantiated and then stored in an array. I have a bunch of different objects (arrays, queries, structures, etc) in the cfc which all gets used but because of the way I am storing them, the methods can be called and I want to prevent that. So here is an example of my issue: Animal.cfc Cat.cfc extends Animal.cfc Cat.cfc: this.name=Kitty; //instance vars go here function init(id){ this.id=arguments.id //setters go here return this; } function meow(){ writeoutput(meow); } So now I am going to store the cats catsArray = []; for(i=1;i lte cats.recordcount;i++){ cat = createobject(component,cat.cfc).init(cats.id[i]); //method to get structure here? catsArray[i] = cat; } Now if you dump the array, you get all of the stuff in cat and animal but you also get the methods to kill cat, feed cat and all. There must be a way to only get the structure with members and not the option to call the cfc methods. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337877 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Any way to prevent storing methods inside of an array
What you want is a serialized form of your CFC. You need to write a method, perhaps called serialization, or maybe toStruct(), that returns a struct containing the data you want. On Tue, Oct 5, 2010 at 4:12 PM, Tony Bentley cascadefreehee...@gmail.com wrote: I have a cfc that gets instantiated and then stored in an array. I have a bunch of different objects (arrays, queries, structures, etc) in the cfc which all gets used but because of the way I am storing them, the methods can be called and I want to prevent that. So here is an example of my issue: Animal.cfc Cat.cfc extends Animal.cfc Cat.cfc: this.name=Kitty; //instance vars go here function init(id){ this.id=arguments.id //setters go here return this; } function meow(){ writeoutput(meow); } So now I am going to store the cats catsArray = []; for(i=1;i lte cats.recordcount;i++){ cat = createobject(component,cat.cfc).init(cats.id[i]); //method to get structure here? catsArray[i] = cat; } Now if you dump the array, you get all of the stuff in cat and animal but you also get the methods to kill cat, feed cat and all. There must be a way to only get the structure with members and not the option to call the cfc methods. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337878 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Any way to prevent storing methods inside of an array
I was hoping to shortcut the process of resetting the 'this' scope to a different scope for the sake of saving time. So you're saying that the only way is to specifically call on the structure members? returnObject = StructNew(); returnObject.id = this.id; returnObject.name = this.name; return returnObject; There must be a better way than a new method than resetting the structure... perhaps using the variables scope instead of the this scope? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337879 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Any way to prevent storing methods inside of an array
I don't think I am actually understanding the question at hand, but hopefully this will at least help you out. First of all, I would strongly discourage anyone from using the this scope of the CFC. There are a variety of reasons for that recommendation, but chief among them is the ability to access and change the instance data from outside of the object. Instead, you will want to use the variables scope, and have getX() and setX() methods to access/change the instance data. Now then, if you are wanting a struct representing the instance data, then you would create a getMemento() method to return that, which would look something like the following: public struct function getMemento() { // duplicate it so the internal data cannot be changed outside of the object return duplicate(variables); } These are just general guidelines and may/should change based upon your actual needs. HTH ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337880 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Any way to prevent storing methods inside of an array
Matt, do you know of a good rundown on the difference between This and Variables scope in a CFC? I have a basic understanding of it but it is always been something I wanted to make sure I understood the fine distinctions in, kind of like the difference between var scoped variables and the local scope in CF9. Cheers, Judah On Tue, Oct 5, 2010 at 3:00 PM, Matt Quackenbush quackfu...@gmail.com wrote: I don't think I am actually understanding the question at hand, but hopefully this will at least help you out. First of all, I would strongly discourage anyone from using the this scope of the CFC. There are a variety of reasons for that recommendation, but chief among them is the ability to access and change the instance data from outside of the object. Instead, you will want to use the variables scope, and have getX() and setX() methods to access/change the instance data. Now then, if you are wanting a struct representing the instance data, then you would create a getMemento() method to return that, which would look something like the following: public struct function getMemento() { // duplicate it so the internal data cannot be changed outside of the object return duplicate(variables); } These are just general guidelines and may/should change based upon your actual needs. HTH ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337881 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Any way to prevent storing methods inside of an array
Thanks Matt. I think I understand the difference between the two scopes and why not to use the this scope. For the very reason I am needing! In most cases it isn't a problem but when methods are exposed it becomes apparent. - Tony Bentley (sent from iPhone) On Oct 5, 2010, at 3:11 PM, Judah McAuley ju...@wiredotter.com wrote: Matt, do you know of a good rundown on the difference between This and Variables scope in a CFC? I have a basic understanding of it but it is always been something I wanted to make sure I understood the fine distinctions in, kind of like the difference between var scoped variables and the local scope in CF9. Cheers, Judah On Tue, Oct 5, 2010 at 3:00 PM, Matt Quackenbush quackfu...@gmail.com wrote: I don't think I am actually understanding the question at hand, but hopefully this will at least help you out. First of all, I would strongly discourage anyone from using the this scope of the CFC. �There are a variety of reasons for that recommendation, but chief among them is the ability to access and change the instance data from outside of the object. Instead, you will want to use the variables scope, and have getX() and setX() methods to access/change the instance data. Now then, if you are wanting a struct representing the instance data, then you would create a getMemento() method to return that, which would look something like the following: public struct function getMemento() { � � // duplicate it so the internal data cannot be changed outside of the object � � return duplicate(variables); } These are just general guidelines and may/should change based upon your actual needs. HTH ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337884 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Any way to prevent storing methods inside of an array
Odd question - why do you care if the methods are exposed? If they are meant to be exposed, what is the point of hiding them? Mark On Wed, Oct 6, 2010 at 11:16 AM, Tony Bentley cascadefreehee...@gmail.comwrote: Thanks Matt. I think I understand the difference between the two scopes and why not to use the this scope. For the very reason I am needing! In most cases it isn't a problem but when methods are exposed it becomes apparent. - Tony Bentley (sent from iPhone) On Oct 5, 2010, at 3:11 PM, Judah McAuley ju...@wiredotter.com wrote: Matt, do you know of a good rundown on the difference between This and Variables scope in a CFC? I have a basic understanding of it but it is always been something I wanted to make sure I understood the fine distinctions in, kind of like the difference between var scoped variables and the local scope in CF9. Cheers, Judah On Tue, Oct 5, 2010 at 3:00 PM, Matt Quackenbush quackfu...@gmail.com wrote: I don't think I am actually understanding the question at hand, but hopefully this will at least help you out. First of all, I would strongly discourage anyone from using the this scope of the CFC. �There are a variety of reasons for that recommendation, but chief among them is the ability to access and change the instance data from outside of the object. Instead, you will want to use the variables scope, and have getX() and setX() methods to access/change the instance data. Now then, if you are wanting a struct representing the instance data, then you would create a getMemento() method to return that, which would look something like the following: public struct function getMemento() { � � // duplicate it so the internal data cannot be changed outside of the object � � return duplicate(variables); } These are just general guidelines and may/should change based upon your actual needs. HTH ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337885 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Any way to prevent storing methods inside of an array
composition over inheritance? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337886 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Any way to prevent storing methods inside of an array
How does composition over inheritance apply here? Mark On Wed, Oct 6, 2010 at 12:09 PM, Tony Bentley cascadefreehee...@gmail.comwrote: composition over inheritance? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337888 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Any way to prevent storing methods inside of an array
On Tue, Oct 5, 2010 at 2:12 PM, Tony Bentley cascadefreehee...@gmail.com wrote: I have a cfc that gets instantiated and then stored in an array. I have a bunch of different objects (arrays, queries, structures, etc) in the cfc which all gets used but because of the way I am storing them, the methods can be called and I want to prevent that. CFCs have methods - that's kinda the point - so I'm a bit puzzled as to what you're really trying to achieve? Now if you dump the array, you get all of the stuff in cat and animal but you also get the methods to kill cat, feed cat and all. There must be a way to only get the structure with members and not the option to call the cfc methods. Why use CFCs at all then? If all you want is an array of structs, why not load your data into structs instead of using CFCs? -- Sean A Corfield -- (904) 302-SEAN Railo Technologies, Inc. -- http://getrailo.com/ An Architect's View -- http://corfield.org/ If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337889 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Any way to prevent storing methods inside of an array
On Oct 5, 2010, at 8:10 PM, Sean Corfield wrote: On Tue, Oct 5, 2010 at 2:12 PM, Tony Bentley cascadefreehee...@gmail.com wrote: I have a cfc that gets instantiated and then stored in an array. I have a bunch of different objects (arrays, queries, structures, etc) in the cfc which all gets used but because of the way I am storing them, the methods can be called and I want to prevent that. CFCs have methods - that's kinda the point - so I'm a bit puzzled as to what you're really trying to achieve? True, they do but I saw the possibility that storing the cfc's method when I really only wanted the members could lead to problems. Maybe not. If someone here said that doing so was harmless, especially you or Ray I might chill out and take your advice. No far no one has said that its okay and nothing bad is going to happen. Now if you dump the array, you get all of the stuff in cat and animal but you also get the methods to kill cat, feed cat and all. There must be a way to only get the structure with members and not the option to call the cfc methods. Why use CFCs at all then? If all you want is an array of structs, why not load your data into structs instead of using CFCs? I thought there might be a way without having to retype all of the items in the scope of that object to store them. There are work arounds I'm sure. Maybe I need to go back and learn some patterns that could automate this. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337890 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Any way to prevent storing methods inside of an array
On Tue, Oct 5, 2010 at 9:51 PM, Tony Bentley cascadefreehee...@gmail.com wrote: True, they do but I saw the possibility that storing the cfc's method when I really only wanted the members could lead to problems. Maybe not. If someone here said that doing so was harmless, especially you or Ray I might chill out and take your advice. No far no one has said that its okay and nothing bad is going to happen. I guess I don't even understand why you'd think there would be a problem? Objects have methods. If you store objects, they still have methods. Why do you think this could be a problem? You haven't explained what you're trying to do and *why* you think having the methods callable is... anything other than expected behavior. Sorry if I'm not being very helpful but I just can't get my head around where you're coming from on this... -- Sean A Corfield -- (904) 302-SEAN Railo Technologies, Inc. -- http://getrailo.com/ An Architect's View -- http://corfield.org/ If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337891 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Any way to prevent storing methods inside of an array
What exactly are you trying to accomplish? Or, perhaps I should ask, what is the problem that you are trying to alleviate by hiding methods? If we know the answer to those questions, we can steer you in the right direction. Right now, though, we don't really have much to go on. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337892 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
coldfusion 8 split word in array of letters
Hey all, In CF9, this splits a word into an array of letters: cfset myArr = listToArray(myWord, ) / However, unless I'm crazy, this doesn't work in CF8. Can anyone tell me how to easily split a word into an array of letters in CF8? Thanks for any insight, Brian ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337426 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: coldfusion 8 split word in array of letters
Ah, I had forgotten that cf strings are java string objects under the hood. Calling myString.split() splits each letter of the word into an array. I noticed that this does, however, insert an empty element into the first position in the array, which was undesirable. To address this, I found a post by Brian Rinaldi which mentioned a udf on cflib.org called arrayCompact (link below) which removed the unwanted empty element in the array. Anyway, thanks, I just wanted to post this reply for future reference in case anyone else has this problem. Best, Brian http://www.cflib.org/index.cfm?event=page.udfbyidudfid=1564 ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337428 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: coldfusion 8 split word in array of letters
You could also just loop from one to the length of the string. Then use mid() to populate an array. Not as elegant as split(), but it is documented ;) Ah, I had forgotten that cf strings are java string objects under the hood. Calling myString.split() splits each letter of the word into an array. Just be aware the result of split() is not technically a CF array. So it may not behave the way you might expect with some array functions. But since you passing the result into arrayCompact, which does return a CF array, that is not an issue here. -Leigh ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337429 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: coldfusion 8 split word in array of letters
Hey Leigh, it's very interesting that you mention that about the Java array. In fact, because it was a Java array, I was using the techniques outlines by the ever helpful Ben Nadel in this post (link below) to convert it back to a CF array. After your comments however, I took the conversion piece of code out and just sent the Java array into the arrayCompact function and things still work ok, with a CF array being returned from the function. This surprises me to a certain extent as the arrayCompact function is indeed calling a few CF specific functions on the passed in array, which I would have expected to blow up without the conversion prior to passing the array in. I guess it's simply the case that some CF functions are supported on Java arrays (arrayToList for example) while others are not (arrayAppend as an example). Anyway, things are working now and I do appreciate you taking the time to comment. Best, Brian http://www.bennadel.com/blog/760-Converting-A-Java-Array-To-A-ColdFusion-Array.htm ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337430 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: coldfusion 8 split word in array of letters
I guess it's simply the case that some CF functions are supported on Java arrays (arrayToList for example) while others are not (arrayAppend as an example). Exactly. The ones that will fail are probably all ones that modify arrays. As mentioned in Ben's entry, the java arrays are immutable. So any attempt to change them causes an exception. Great entry though (not at all surprising ;) Anyway, it is always good to be aware of the nuances. Cheers Leigh ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337431 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: coldfusion 8 split word in array of letters
OT: Or slightly anyway. How do you alter an array in Java? I'm completely unfamiliar with Java so maybe that's a dumb question. And I know I could Google it but I'll probably spend two hours reading and not get as concise an answer as I'd get here in a few sentences. On Thu, Sep 23, 2010 at 8:22 PM, Leigh cfsearch...@yahoo.com wrote: I guess it's simply the case that some CF functions are supported on Java arrays (arrayToList for example) while others are not (arrayAppend as an example). Exactly. The ones that will fail are probably all ones that modify arrays. As mentioned in Ben's entry, the java arrays are immutable. So any attempt to change them causes an exception. Great entry though (not at all surprising ;) Anyway, it is always good to be aware of the nuances. Cheers Leigh ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337435 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: coldfusion 8 split word in array of letters
OT: Or slightly anyway. How do you alter an array in Java? I'm completely unfamiliar with Java so maybe that's a dumb question. And I know I could Google it but I'll probably spend two hours reading and not get as concise an answer as I'd get here in a few sentences. Java arrays are a little different than CF arrays. You have to declare a java array's size up front. Once declared, the array is immutable. So unlike in CF, you cannot append elements or remove them. You can only change the values of existing elements. So it is not really what we think of as an array in CF terms. When you think CF array, think java List. ie A modifiable collection of elements. Because that is essentially what it is internally: a java.util.List ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337437 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: coldfusion 8 split word in array of letters
Phenomenal answer. Thanks! So would a Java dev just declare a new array one index larger than the old one when adding items? Or would one not use arrays for the same purposes in Java? I promise I don't intend on tricking you into teaching me Java through an OT cf-talk thread. On Thu, Sep 23, 2010 at 9:06 PM, Leigh cfsearch...@yahoo.com wrote: OT: Or slightly anyway. How do you alter an array in Java? I'm completely unfamiliar with Java so maybe that's a dumb question. And I know I could Google it but I'll probably spend two hours reading and not get as concise an answer as I'd get here in a few sentences. Java arrays are a little different than CF arrays. You have to declare a java array's size up front. Once declared, the array is immutable. So unlike in CF, you cannot append elements or remove them. You can only change the values of existing elements. So it is not really what we think of as an array in CF terms. When you think CF array, think java List. ie A modifiable collection of elements. Because that is essentially what it is internally: a java.util.List ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337438 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: coldfusion 8 split word in array of letters
So would a Java dev just declare a new array one index larger than the old one when adding items? Or would one not use arrays for the same purposes in Java? Yes, they tend to be used differently. If you expect to be adding or removing elements frequently, you probably would not use a java array at all. But would select an object like a List, that is designed to change size. There are no absolutes, but typically if you would select an array for something in CF .. in java you would use a List instead. (Because that is what CF arrays really are anyway .. ;-) ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337440 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: coldfusion 8 split word in array of letters
Cfset mySTring = This is fun cfset myArray = mySTring.split('') cfloop from=1 to=#ArrayLen(myArray)# step=1 index=x cfoutputPosition #x# = #myArray[x]#br//cfoutput /cfloop Yes, it's THAT easy. If you run the code above you'll see this: Position 1 = Position 2 = T Position 3 = h Position 4 = i Position 5 = s Position 6 = Position 7 = i Position 8 = s Position 9 = Position 10 = f Position 11 = u Position 12 = n Note that the first element is an empty string. Rick ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337441 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: coldfusion 8 split word in array of letters
The following is less code but would it execute slower because of the mid? I can't test right now. cfset myString = This is funner / cfloop from=1 to=#len(myString)# index=x cfoutputPosition #x# = #mid(myString,x,1)#br//cfoutput /cfloop On Thu, Sep 23, 2010 at 9:28 PM, Rick Root rick.r...@gmail.com wrote: Cfset mySTring = This is fun cfset myArray = mySTring.split('') cfloop from=1 to=#ArrayLen(myArray)# step=1 index=x cfoutputPosition #x# = #myArray[x]#br//cfoutput /cfloop Yes, it's THAT easy. If you run the code above you'll see this: Position 1 = Position 2 = T Position 3 = h Position 4 = i Position 5 = s Position 6 = Position 7 = i Position 8 = s Position 9 = Position 10 = f Position 11 = u Position 12 = n Note that the first element is an empty string. Rick ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337442 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: coldfusion 8 split word in array of letters
This isn't the point though. He wants to convert a string to an array of letters. =) The output is just an example. Rick On Thu, Sep 23, 2010 at 9:33 PM, Michael Grant mgr...@modus.bz wrote: The following is less code but would it execute slower because of the mid? I can't test right now. cfset myString = This is funner / cfloop from=1 to=#len(myString)# index=x cfoutputPosition #x# = #mid(myString,x,1)#br//cfoutput /cfloop On Thu, Sep 23, 2010 at 9:28 PM, Rick Root rick.r...@gmail.com wrote: Cfset mySTring = This is fun cfset myArray = mySTring.split('') cfloop from=1 to=#ArrayLen(myArray)# step=1 index=x cfoutputPosition #x# = #myArray[x]#br//cfoutput /cfloop Yes, it's THAT easy. If you run the code above you'll see this: Position 1 = Position 2 = T Position 3 = h Position 4 = i Position 5 = s Position 6 = Position 7 = i Position 8 = s Position 9 = Position 10 = f Position 11 = u Position 12 = n Note that the first element is an empty string. Rick ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337443 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: coldfusion 8 split word in array of letters
Oh and Leigh is correct, you can't manipulate the resulting Array from calling the .split() method on a string.. ie, neither of these work: cfset ArrayAppend(myArray,Y) cfset myArray.push(' ') The latter doesn't work because apparently, java arrays have no push method :) Apparently, that's the perl programmer in me. Rick ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337444 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: coldfusion 8 split word in array of letters
Personally, I would not worry about speed prematurely. Not unless you have a very large string. So for normal stuff, I would probably use that approach (ie MID combined with ArrayAppend). ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337446 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: coldfusion 8 split word in array of letters
typically if you would select an array for something in CF .. in java you would use a List instead. That statement is probably a little too broad. What I meant was, for CF tasks requiring resizable arrays .. you would probably use a List type object in java. -Leigh ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337447 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
array help how do I do this?
can anyone tell me what I am doing wrong here as as the hotspots does not seem to like this array i.e. the web service responses back Required field 'title' etc for all fields cfscript var response = StructNew(); response['hotspots'] = [ { hotspots.distance ='100', attribution=This is a test layer POI provider, title= My layer - snowy4, lon= 53.472696, lat= '-2.261843', imageURL='null', line4= 'RADIOLIST-None,CustSlider-None', line3= 'SEARCHBOX - asdfdgxdg', line2= 'DevlId - 896Settings: range=1000', actions='', type='0', id='test_1' } ]; response['layer'] = genciamedialtd; response['errorString']='ok'; response['morePages']='false'; response['errorCode']= '0'; response['nextPageKey']='null'; /cfscript ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334963 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: array help how do I do this?
not an array issues must be to do with the upper-case conversion again, how do i get around that with... response['hotspots'] = [ { distance =100, attribution=This is a test layer POI provider, title= My layer - snowy4, lon= 53.472696, lat=-2.261843, imageURL=null, line4=RADIOLIST-None,CustSlider-None, line3=SEARCHBOX - asdfdgxdg, line2=DevlId - 896Settings: range=1000', actions=, type=0, id=test_1 } ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334965 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Array of struct into ORACLE using stored procedures
In Cold Fusion I have a large array of struct I'm trying to pass into ORACLE 10g using stored procedures. I am hitting a performance wall inside ORACLE (probably self inflicted). I don't know of a way to transfer a complex array directly to ORACLE -- if there is, I'd love to hear it. So what I've done is translate the array into a CLOB of delimited values where each array element is separated by a semicolon and each property value by a comma like: Prop1,prop2,prop3;Prop1,prop2,prop3;Prop1,prop2,prop3;Prop1,prop2,prop3; I can then pass the CLOB into ORACLE where I wrote a little parsing procedure that pulls the data elements out into a Global Temporary table which I then can merge into other data tables. The issue seems to be on the ORACLE end. It is taking too long to parse when the array gets large (10k rows takes about 4 mins). What I need is either a different method to move the array into ORACLE or to improve my parsing routine (see attached). Ideas? Warren Koch 314-323-2298 PROCEDURE get_items IS /* This routine extracts the item values from the input string into a global temporary table RENT_IMPORT_ITEMS It uses two delimiters: ; to separate items , to separate values */ instringCLOB; data_string VARCHAR2(2000); data_item VARCHAR2(100); data_type VARCHAR2(100); data_revVARCHAR2(100); data_shtVARCHAR2(100); data_location INTEGER; BEGIN instring := UPPER(TRIM(in_list_items)) || ';'; data_location := INSTR(instring, ';'); EXECUTE IMMEDIATE 'TRUNCATE TABLE RENT_IMPORT_ITEMS '; WHILE data_location 0 LOOP data_string := SUBSTR(instring, 1, data_location - 1); data_string := REPLACE(data_string || '', ',', ' ,'); BEGIN SELECT SUBSTR(TRIM(REGEXP_SUBSTR(data_string, '[^,]+', 1, 1)), 1, 35) INTO data_item FROM DUAL; SELECT SUBSTR(TRIM(REGEXP_SUBSTR(data_string, '[^,]+', 1, 2)), 1, 5) INTO data_type FROM DUAL; SELECT SUBSTR(TRIM(REGEXP_SUBSTR(data_string, '[^,]+', 1, 3)), 1, 4) INTO data_rev FROM DUAL; SELECT SUBSTR(TRIM(REGEXP_SUBSTR(data_string, '[^,]+', 1, 4)), 1, 20) INTO data_sht FROM DUAL; INSERT INTO rent_import_items (item, item_type, item_rev, item_sht ) VALUES (data_item, data_type, data_rev, data_sht ); EXCEPTION WHEN OTHERS THEN NULL; END; instring := SUBSTR(instring, data_location + 1); data_location := INSTR(instring, ';'); END LOOP; EXCEPTION WHEN OTHERS THEN RAISE; END; ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334807 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
How to pass an array as a parameter into a MS SQL 2008 stored procedure
Hi all, I am running CF 8 and the database back end is MS SQL 2008. A stored procedure is written in MS SQL 2008 and one of the parameters would take in an array. Now, my question is, how can I pass an array to the stored procedure using ColdFusion? Thanks in advance, Monte ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334621 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm