yes yes yes!!! I just couldn't see that at all....!!!!!

Feeling a bit stupid now.... :-)

Cheers Raymond... was starting to question my sanity over it!!!

-----Original Message-----
From: Raymond Camden 
Sent: 31 July 2003 12:55
To: CF-Talk
Subject: RE: Help with a pesky UDF...


Oh, I think I see it. In the for loop, you have j+1 as the third item.
It should be j=j+1.

========================================================================
===

> -----Original Message-----
> From: David Collie (itndac)
> Sent: Thursday, July 31, 2003 5:23 AM
> To: CF-Talk
> Subject: Help with a pesky UDF...
> 
> 
> Hello all,
> 
> Having problems with the following UDF and need a little bit
> of help if possible....  running CF5 btw on IIS 5
> 
> Everything runs fine as the code is below, but as soon as I
> move the debug comments inside the second 'for' loop but 
> before the 'if' statement, the page just hangs and kills the 
> thread.... it just doesn't seem to want loop over the count 
> of the query...
> 
> I can't see a reason why it shouldn't work.... Code as
> follows with test query...
> 
> 
> <cfscript>
>       theQuery = QueryNew("STATUS,COUNT");
>       QueryAddRow(theQuery, 1);
>       QuerySetCell(theQuery, "STATUS", "A", 1);
>       QuerySetCell(theQuery, "COUNT", "3", 1);
>       QueryAddRow(theQuery, 2);
>       QuerySetCell(theQuery, "STATUS", "C", 2);
>       QuerySetCell(theQuery, "COUNT", "2", 2);
>       QueryAddRow(theQuery, 3);
>       QuerySetCell(theQuery, "STATUS", "O", 3);
>       QuerySetCell(theQuery, "COUNT", "7", 3);
> </cfscript>
> 
> <cfdump var="#theQuery#">
> 
> <cfscript>
>       function udfMakeStatus(q) {
>               var i = 1;
>               var j = 1;
>               var count = 0;
>               var text = "";
>               var code = "";
>               var lStatus =
> "O,Offered,R,Rejected,A,Accepted,C,Confirmed,F,Finished";
>               var rHTML = "<em>OFFER STATUS</em>&nbsp;|";
>               
>               for (i=1; i LTE ListLen(lStatus); i=i+2) {
>                       count = 0;
>                       text = ListGetAt(lStatus, i+1);
>                       code = ListGetAt(lStatus, i);
>                       
>                       if (IsQuery(q) AND q.RecordCount GT 0) { 
>                       writeoutput("text=" & text & " - code=" & code &
> " - rc=" & q.RecordCount & "<br />");
>                               /*
>                               for (j=1; j LTE q.RecordCount; j+1) {
>                                       writeoutput("text=" & text & " -
> code=" & code & " - j=" & j & "<br />");
>                                        
>                                       if (q.STATUS[j] EQ code) {
>                                               count = q.COUNT[j];
>                                       }
>                                       
>                               }
>                               */ 
>                       }
>                       rHTML = rHTML & "&nbsp;" & text & " - " & count
> & "&nbsp;|";
>               }
>               rHTML = rHTML & "";
>               return rHTML;
>       }
> 
>       writeoutput(udfMakeStatus(theQuery));
> </cfscript>
> 
> 
> I'm expecting an output (without the writeoutput's) of....
> 
> 'OFFER STATUS | Offered - 7 | Rejected - 0 | Accepted - 3 |
> Confirmed - 2 | Finished - 0 |'
> 
> I've been tearing my hair out with it and I want it to
> work... or at least know why it doesn't work :-)
> 
> Cheers in advance
> 
> DC
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to