Solved

Saving an array to a string? ColdFusion.

Posted on 2014-01-13
2
293 Views
Last Modified: 2014-01-13
I am wondering if this is possible?
I would like to query a db:
Select color,car,age

FROM this table

color            car              age
blue           family             1
green         sport               2
red             van                 3



I want to output the results of the query as:
<cfset string="[blue,family,1] , [green,sport,2] , [red.van,3]">


 is this possible?

I have tried many ways, all are either outputting only a single row,  or trying to use ValueList()  i am returning :
 [blue,red,green] [family, sport,van] [1,2,3]...

Thanks!!!
0
Comment
Question by:izweig
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
ID: 39778321
Sure, you can format a string to look anyway you want it to look.

<cfset str = "">
<cfoutput query="myQuery">
   <cfset str = listAppend(str," [#myQuery.color#,#car#,#age#] ")>
</cfoutput>

<cfoutput>#str#</cfoutput>
0
 

Author Comment

by:izweig
ID: 39778338
Thank you, exactly what I was looking for! Soo easy when you know how!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question