Ok, I chickened out going to the DMV on a Friday, Monday is soon enough
That does seem odd. I'm not as good with javascript as I am with VBScript/ASP but even so that doesn't seem logical. My first thought was that it could be some kind of scope issue, but even so, using the String function shouldn't have changed that.
In any event., you will probably want your Response.Write's inside the while statement simply because that will allow you to write all the values rather then just the last record.
if your interested in looking deeper to see what the source of this problem was, maybe try putting a counter in the loop to see how many records it is looping through?
You could go real nuts with your output statements also, that might give us a clue, maybe something like:
Code:
sSQL = "Select art_quality, COUNT(art_quality) as 'Total AQ' FROM table GROUP BY art_quality"
rs.Open(sSQL,conn);
if(!rs.EOF && !rs.BOF) {
rs.MoveFirst();
while(!rs.EOF) {
Response.Write("Art Quality: [" + rs("art_quality") + "]<br>\n";
Response.Write("Art Quality == 0: [" + (rs("art_quality") == 0) + "]<br>\n";
Response.Write("Art Quality == 1: [" + (rs("art_quality") == 1) + "]<br>\n";
if(rs("art_quality") == 0) {
Response.Write("Assigning Total AQ: [" + rs("Total AQ") + "]";
tot_AQ_NA = rs("Total AQ");
if(tot_AQ_NA.length > 0){
Response.Write("...OK!<br>\n");
}
else{
Response.Write("...<span style='color:Red'>FAIL!</span><br>\n");
}
}
else if(rs("art_quality") == 1) {
Response.Write("Assigning Total AQ: [" + rs("Total AQ") + "]";
tot_AQ_VS = rs("Total AQ");
if(tot_AQ_VS.length > 0){
Response.Write("...OK!<br>\n");
}
else{
Response.Write("...<span style='color:Red'>FAIL!</span><br>\n");
}
}
else{
Response.Write("<span style='color:Red'>Assignment Failed!</span> - Art Quality matches neither 0 or 1<br>\n";
}
rs.MoveNext();
}
}
Response.Write "<br>\nStored Values:<br>\n";
Response.Write "0: " + tot_AQ_NA + "<br>\n";
Response.Write "1: " + tot_AQ_VS + "<br>\n";
Well, that may help..I just realized after writing all of that, you may get an error on the .length function. Since these are coming from the database as numbers somehow your string conversion is casting them to strings. If we add in a string cast so we can check their values we will lose th capability of detecting the problem...maybe instead of the .length checks change it to check the value > -1 and initialize those two variables as -1. Ok, revised copy of the above:
Code:
sSQL = "Select art_quality, COUNT(art_quality) as 'Total AQ' FROM table GROUP BY art_quality"
rs.Open(sSQL,conn);
tot_AQ_NA = -1;
tot_AQ_VS = -1;
if(!rs.EOF && !rs.BOF) {
rs.MoveFirst();
while(!rs.EOF) {
Response.Write("Art Quality: [" + rs("art_quality") + "]<br>\n";
Response.Write("Art Quality == 0: [" + (rs("art_quality") == 0) + "]<br>\n";
Response.Write("Art Quality == 1: [" + (rs("art_quality") == 1) + "]<br>\n";
if(rs("art_quality") == 0) {
Response.Write("Assigning Total AQ: [" + rs("Total AQ") + "]";
tot_AQ_NA = rs("Total AQ");
if(tot_AQ_NA > -1){
Response.Write("...OK!<br>\n");
}
else{
Response.Write("...<span style='color:Red'>FAIL!</span><br>\n");
}
}
else if(rs("art_quality") == 1) {
Response.Write("Assigning Total AQ: [" + rs("Total AQ") + "]";
tot_AQ_VS = rs("Total AQ");
if(tot_AQ_VS > -1){
Response.Write("...OK!<br>\n");
}
else{
Response.Write("...<span style='color:Red'>FAIL!</span><br>\n");
}
}
else{
Response.Write("<span style='color:Red'>Assignment Failed!</span> - Art Quality matches neither 0 or 1<br>\n";
}
rs.MoveNext();
Response.Write("--- Status:\t");
Response.Write((tot_AQ_NA > -1)?"NA: yes<br>":"NA: no<br>");
Response.Write((tot_AQ_VS > -1)?"VS: yes<br>":"VS: no<br>");
}
}
Response.Write "<br>\nStored Values:<br>\n";
Response.Write "0: " + tot_AQ_NA + "<br>\n";
Response.Write "1: " + tot_AQ_VS + "<br>\n";
Anyways, that might be worth a shot. Remember my javascript skills are way rusty though, there may be some syntax errors in there,
-T
01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
Help, the rampaging, spear-waving, rabid network gnomes are after me!