Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Saving an array to a string? ColdFusion.

Posted on 2014-01-13
2
Medium Priority
?
299 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 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

618 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