By the way, when you do your queryAddRow, why do you use 2 and 3? I
think you meant to only add one row at a time.

========================================================================
===
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
(www.mindseye.com)
Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)

Email    : [EMAIL PROTECTED]
Blog     : www.camdenfamily.com/morpheus/blog
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda 

> -----Original Message-----
> From: David Collie (itndac) [mailto:[EMAIL PROTECTED] 
> 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

Get the mailserver that powers this list at 
http://www.coolfusion.com

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

Reply via email to