RE: Simple XML cfscript question

2005-07-13 Thread Matt Osbun
If you don't *need* this done with cfscript, try this. This is a copy and paste from something I'm putting together, with names changed to protect the innocent... cfquery name=qLessons datasource=coursesDB SELECT ID, Lesson, Required, Time FROM Lessons /cfquery

RE: Simple XML cfscript question

2005-07-13 Thread Merrill, Jason
Well, I got it working, didn't realize I could use the Array access operator like I can in Flash and Javascript - gotta love ECMA. Here is the script, but how can I make it cleaner - i.e. get names of fields and then loop over those? cfscript lrXML = XmlNew(); lrXML.xmlRoot =

RE: Simple XML cfscript question

2005-07-13 Thread Merrill, Jason
Well, I got it working, didn't realize I could use the Array access operator like I can in Actionscript and Javascript (ECMA praise here?). Here is the script, but how can I make it cleaner so not as much is hardcoded - i.e. get names of all the fields and then loop over those x number of

Re: Simple XML cfscript question

2005-07-13 Thread Anthony Prato
queryname.columnlist is what you are looking for. use listlen() to set your upper bound. You may also want to check out cflib.org for some helpful functions like converting query rows to structs, structs to xml, etc. (there are tons of handy functions there) Anthony On 7/13/05, Merrill, Jason

RE: Simple XML cfscript question

2005-07-13 Thread Merrill, Jason
Thanks very much - could you shoot me an example of usage of both columnlist and listlen() in this context? I'm new to ColdFusion and can't quite wrap my head around it. I tried: for (i = 1; i LTE #qLessons.RecordCount#; i = i + 1){ lrXML.lData.XmlChildren[i] =

Re: Simple XML cfscript question

2005-07-13 Thread Anthony Prato
i'm a bit rusty on my syntax, i've been working on some asp projects recently (yuk) try this out cfscript lrXML = XmlNew(); lrXML.xmlRoot = XmlElemNew(lrXML,lData); for (ii = 1; ii LTE qAllLessons.RecordCount; ii = ii + 1){ lrXML.lData.XmlChildren[ii] =

RE: Simple XML cfscript question

2005-07-13 Thread Merrill, Jason
Nevermind, after some headaches, I figured it out on my own: cfquery name=GetAll datasource=coursesDB SELECT * FROM Lessons /cfquery !-- the following query used to dynamically get the table names !-- cfquery name=GetTables datasource=coursesDB SELECT MSysObjects.Name