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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array Question 4

Status
Not open for further replies.

alsjka

Technical User
Jan 21, 2003
114
US
I have the follow code I am trying to run with no luck. I am not that familar with arrays so If someone could shed some light on this it would be great.

Here is what I am trying to do. I want to get live information from a machine store the value in a array(?) then refresh the page 1 min later and add the new live value to the array. This will continue for 8 hours then the array will be cleared. Is this possible. ARGH!



<cfset session.myarray=ArrayNew(1)>
<cfset session.myarray2=ArrayNew(1)>
<cfset session.myarray3=ArrayNew(1)>

<cfquery name="one" datasource="source">
select top 5 tagname, value,datetime
from table
where tagname = total_produced'
</cfquery>


<CFSET arrayappend(session.myarray,one.value)>

<cfoutput>
#session.myarray[1]#<br>
</cfoutput>

 
Code:
<cfscript>
  function isArrayElement(aName,aElem) {
    [red]if(ArrayLen(aName) gt aElem) {[/red]
      return false;
    } else {
      try {
        testVar = evaluate(aName[aElem]);
        return true;
      } catch(any test) {
        return false;
      }
    [red]}[/red]
  }
</cfscript>

The way I see it, if aElem is greater than the arraylen of the array.. then its automatically false.

It should help the script.. but I'm not in a position to test any code right now.

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
i was thinking about going that way but wanted to keep it to one element passed to the udf. :)

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
-Douglas Adams (1952-2001)
 
Yeah just a thought, but anyway, have a star. (I could do the same thing with one variable, but bleah, it gets very... overkill...ish) :)

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
thanks for the stars guys :)

an faq is born :)

faq232-5617

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
-Douglas Adams (1952-2001)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top