New to the list, new to the language, quite possibly in WAY over my head...and
posting this to the list at the advice of our webmaster.

I'm using Cold Fusion to compare two files by loading them into arrays, and I'd
like to know if anyone can help me out with some array problems.  (The short
explanation:  I'm comparing source code from another programming language
(Mumps), and using CF to do it because the code files are on different servers,
and it's actually easier to get to from outside than inside...if anyone wants
the long explanation, I'll be glad to give it...if you have an afternoon...or
maybe a weekend.)  This is as much a systems tool for our department as it is
"proof to my boss I can do it"...it's also my own private "learn CF the HARD
way!" project, I think...anyway...

I'm using a CFQuery to get the TEXT and the NUMBER of each line of code and load
it into two arrays, and then using CompareNoCase in a loop to check for
differences.  It's got some bells and whistles, too; if it finds a difference,
it will actually check a few lines forward to see if that line is inserted and
the rest of the program is the same.  Or at least, it's supposed to.

My problem is in the indexing of the array.  If I bring the query over with
"ORDER BY LINE NUMBER" it times out--too much going on, I guess, and it loses
the connection to the other server.  So, instead, I'm bringing it over in
whatever order it comes across.  I'm loading it into an array, using the LINE
NUMBER as the index, and I'm hitting a glitch that has me stumped.

It brings over lines 1-50, then lines 52-100, and then line 51.  It loads all of
these lines into the array.  Then, when I go to do my compare, it can't find
line 51, and dies at that point.  I know line 51 is there, because I told it to
CFOUTPUT each line as it went into the array; it just wasn't the 51st item to go
into the array...I would think it wouldn't matter what ORDER they go in, as long
as the line number controls where in the array it gets stored...?

Here's a code snippet:

<CFSET qArray1 = ArrayNew(1)>
<CFSET temp = ArrayResize(qArray1, GetQuery1.RecordCount)>
<CFLOOP query="GetQuery1">
    <CFSET temp= ArrayInsertAt(qArray1,#SEQUENCE_NUMBER#, "#TEXT#")>
    <CFOUTPUT> For testing purposes - Q1,
*#SEQUENCE_NUMBER#*,#TEXT#</cfoutput><BR>
</cfloop>

Any advice on this would really be appreciated...and if I seriously mangled my
description here, I'll be glad to re-explain in further email.  Thanks in
advance...

Allan Davis


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to