Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cfdump related!

Status
Not open for further replies.

cfdeveloper

Programmer
Nov 20, 2003
144
GB
Hello everybody,

I want to re-arrange everything dumped out by cfdump and comma separate all the elements of the cfdump structure.

<cfdump var="#url#">

I want to take the results returned by the above cfdump structure and comma separate each element. I want to insert all the comma separated elements into a db column.

Ex:

struct

FirstName Joe
LastName Bloggs
Phone 35345
Building CA

Change this into:

FirstName: Joe, LastName: Bloggs, Phone: 35345, Building: CA

Can somebody please show me how to do this?

Best regards,
cfcoder
 

All CFDUMP does is to basically loop over the structures in CF. URL, Form, Cookie, CGI, Session etc scopes are all stored as structures internally, meaning that you can use a CFLOOP to loop over them using the COLLECTION attribute of CFLOOP. Like this:

<CFLOOP COLLECTION="#URL#" ITEM="i">
<CFOUTPUT>
#i#:#URL#,
</CFOUTPUT>
</CFLOOP>

Hope this helps!

Tony
 
thanks Tony, you're right, url scope is stored as structures. I figured out how to do this.

<cfset elementsList = "">
<cfloop collection="#url#" item="urlVar">
<cfset elementsList = ListAppend(elementsList, "#urlVar#:#url[urlVar]#", ",")>
</cfloop>

<cfoutput>#elementsList#</cfoutput>
Cheers
cfcoder
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top