Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to populate 2d array from query

Posted on 2006-05-22
3
Medium Priority
?
239 Views
Last Modified: 2013-12-24
How do I populate array from query.

select permitno, date, current, last
from database

Give this output:
1167 01/01/2006 903.10 897.90
1167 02/01/2006 923.40 903.10
1167 03/01/2006 963.00 923.40
777 01/01/2006 2474.60 2444.00
777 02/01/2006 2516.00 2474.60
777 03/01/2006 2615.30 2516.00
783 01/01/2006 1736.50 1731.00
783 02/01/2006 1736.50 1736.50
783 03/01/2006 1838.50 1736.50

what I would like to see is this?

1167  01/01/2006 903.10 897.90   02/01/2006 923.40 903.10       03/01/2006 963.00 923.40
777 01/01/2006 2474.60 2444.00   02/01/2006 2516.00 2474.60   03/01/2006 2615.30 2516.00
783 01/01/2006 1736.50 1731.00   02/01/2006 1736.50 1736.50   03/01/2006 1838.50 1736.50

Thanks in Advance
Trainmom
0
Comment
Question by:trainmom
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
mkishline earned 2000 total points
ID: 16735011
I think something like this might work. I'm not entirely sure what it is that you're looking to do with this object once it's been built.

<cfset array_d_1 = 1 />
<cfset two_D_array = ArrayNew(1) />

<cfoutput query="queryname" group="permitno">
      <cfset two_D_array[array_d_1] = ArrayNew(1) />
      <cfset ArrayAppend(two_D_array[array_d_1],permitno) />
      <cfoutput>
            <cfset ArrayAppend(two_D_array[array_d_1],"#DateFormat(date,'mm/dd/yyyy')# #current# #last#") />
      </cfoutput>
      <cfset array_d_1 = array_d_1 + 1 />
</cfoutput>

<cfdump var="#two_D_array#" />
0
 

Author Comment

by:trainmom
ID: 16735205
THANK YOU........ THANK YOU ..... THANK YOU

IT WORKED!!!!!!

The only thing I had to change was
THIS:
 <cfset ArrayAppend(two_D_array[array_d_1],"#DateFormat(date,'mm/dd/yyyy')# #current# #last#") />

TO:

 <cfset ArrayAppend(two_D_array[array_d_1],"#DateFormat(date,'mm/dd/yyyy')#) />
<cfset ArrayAppend(two_D_array[array_d_1],"#current# />
<cfset ArrayAppend(two_D_array[array_d_1],"#last# />

THANKS AGAIN, as I was headed way down the wrong path.


0
 
LVL 12

Expert Comment

by:mkishline
ID: 16735233
Glad it helped. Good luck with your project.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
What You Need to Know when Searching for a Webhost Provider
Screencast - Getting to Know the Pipeline
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

580 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