Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / July 2008



Tip: Looking for answers? Try searching our database.

Kind of query on an array

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
aubweb - 25 Jul 2008 10:33 GMT
Hi,

I have an array like this :

DATA  |   YEAR   |   SCENARIO   |  JAN  |   FEB   |   MAR   |   ....
data1        2008             1                120       101         109  
data2        2008             2                120       105         104  
data3        2007             1                100       108         111  
data4        2008             1                124       101         116  

and I want to search something like we do with a query but on an array

SELECT JAN
FROM myArray
WHERE
YEAR = 2008
AND SCENARIO = 1
AND DATA=  data3

is it possible ? and how to do it ?

Thanks !
GArlington - 25 Jul 2008 11:11 GMT
> Hi,
>
[quoted text clipped - 5 lines]
>  data3        2007             1                100       108         111
>  data4        2008             1                124       101         116

It looks like an array of structures, which is exactly what query
object is. So, set your data as a query object from the start and you
will be able to use it the way you want...
>  and I want to search something like we do with a query but on an array
>
[quoted text clipped - 8 lines]
>
>  Thanks !
Dan Bracuk - 25 Jul 2008 12:12 GMT
It's convoluted but possible.  Where did the array come from in the first place?
aubweb - 25 Jul 2008 12:23 GMT
Here's a simple schema :

1. query from flex to coldfusion
2. cf return array to flex

3. from flex I send the array to cf in order to make some calcuations (that's
where I need to "query" the array)
4. new array returned by cf to flex

the idea is that I make a query on the server A (sql server) that returns all
the infos I need
then I send those infos to the server B (coldfusion) to avoid using server A
...

do you know what I mean ? :wink;
Adam Cameron - 25 Jul 2008 13:07 GMT
>  I have an array like this :

That looks like an array of structs rather than simply an array.  Arrays
can have only numeric indices.

You could loop over whatever data structure it is and populate a query.
Then you could QoQ the query.

Signature

Adam

Dan Bracuk - 26 Jul 2008 04:22 GMT
What Adam said is correct, but not the only way to do it.  If you are going to loop through the array anyhow, you could add some if/else code to get your answer.
musicmp3 - 29 Jul 2008 11:28 GMT
Very useful site. I learned a lot from this site. Thanks.
For nice music visit http://musiktag.eu
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.