tags:

views:

43

answers:

3

I have used cfhttp to read a .cfm file, but I want to store the data in one variable or array and pass this variable to a cfchart to display it in chart format. How can I do this?

A: 

Use XMLParse and then pull the information you need out of the XML Object and put it into an array or struct or what ever format you need.

As an aside you need to take a look at the online references I've been giving you before asking a question and you also need to mark the previous questions you've asked as answered.

Stephen Moretti
A: 

The answer to this will depend on what the .cfm page is returning. If the returned value is XML, then @stephen is pretty much dead on. XMLParse will convert well-formed XML into nested structures and arrays. You can dump them to view the structure, and loop over them to insert it into the array you need.

If the .cfm page returns a list, you can use listToArray() to convert that directly into an array.

If you get name-value pairs, you'll have to do a little work to assign the data correctly, but there are several approaches.

If you edit your question to include more info about the data being returned, and maybe a sample of both the data and what you need it transformed into, we could probably give more specific advice.

Ben Doom
A: 

Depending on just exactly what your accessing on the .cfm page you're loading via cfhttp, you could try something like:

<cfhttp method="Get"
    url="somepage.cfm"
    result="myResult">
<cfset PageLoad = ArrayNew(1) />

<cfset PageLoad = #ArrayAppend(PageLoad, myResult.FileContent)# />

I use a variation of that code to return and store a call/response to my custom url shortener...

Hope it helps!

RyanNehring