Ask a Question related to Dreamweaver AppDev, Design and Development.
-
Jamesy #1
get my head round this loop prob +ASP
Hi,
I have a recordset loop which has a nested loop, which checks the value
against an array of postcodes.. incrementing a counter by one when it finds
a match..
However I also need to increment a counter when it doesn't find a match...
the problem is however, that obviously whilst this sub-loop is going, it is
constantly finding no match so my "nomatch" figure is totally incorrect..
Instead of adding one when the only thing left is that there isn't a match,
it is obviously adding one everytime it doesn't find a match which isn't
what I need..
I know it's prob something to do with stopping the loop, or setting a var to
True.. but can't get my head round what I should do:
Example:
171 records:
Results:
Scotland: 9
Wales: 8
North East: 115
North West: 10
Midlands: 7
Anglia: 3
South West: 2
South Central: 4
SouthEast: 4
London:
Other: 20187
See? the Other one is adding loads of counts cos, whilst the sub-loop is
happening, is adding one everytime,... I don't want this...
Here#s my code:
<%
For strChart3_i = 1 to arr_PostcodeCount
If strChart3PostcodeValue = arr_PostcodeCheck(strChart3_i) then
If strChart3_i <= 17 then
strChart3_Scotland = strChart3_Scotland + 1
elseif strChart3_i >17 AND strChart3_i <= 23 then
strChart3_Wales = strChart3_Wales + 1
elseif strChart3_i >23 AND strChart3_i <= 39 then
strChart3_NorthEast = strChart3_NorthEast + 1
elseif strChart3_i >39 AND strChart3_i <= 54 then
strChart3_NorthWest = strChart3_NorthWest + 1
elseif strChart3_i >54 AND strChart3_i <= 64 then
strChart3_Midlands = strChart3_Midlands + 1
elseif strChart3_i >64 AND strChart3_i <= 79 then
strChart3_Anglia = strChart3_Anglia + 1
elseif strChart3_i >79 AND strChart3_i <= 91 then
strChart3_SouthWest = strChart3_SouthWest + 1
elseif strChart3_i >91 AND strChart3_i <= 102 then
strChart3_SouthCentral = strChart3_SouthCentral + 1
elseif strChart3_i >103 AND strChart3_i <= 113 then
strChart3_SouthEast = strChart3_SouthEast + 1
elseif strChart3_i >113 AND strChart3_i <= 119 then
strChart3_London = strChart3_London + 1
end if
else
strChart3_Other = strChart3_Other + 1
end if
Next
%>
Any ideas?
Cheers
James
Jamesy Guest
-
infinite loop error... Braking my head
This one is really banging my head! I have a base movie on level 0 with some loadvars functions, a shared object, and 2 buttons that use... -
#24876 [NEW]: Round does not round properly
From: jeff at tmtrading dot com Operating system: Redhat 8.0 PHP version: 4CVS-2003-07-30 (stable) PHP Bug Type: Math related... -
#24828 [Asn->Csd]: round() function doesn't round !
ID: 24828 Updated by: edink@php.net Reported By: christophe dot bidaux at netcourrier dot com -Status: Assigned... -
#24828 [Opn->Asn]: round() function doesn't round !
ID: 24828 Updated by: iliaa@php.net Reported By: christophe dot bidaux at netcourrier dot com -Status: Open... -
#24828 [NEW]: round() function doesn't round !
From: christophe dot bidaux at netcourrier dot com Operating system: Windows 98SE PHP version: 4CVS-2003-07-27 (stable) PHP Bug... -
Jamesy #2
Re: get my head round this loop prob +ASP
ignore - all done..
James
"Jamesy" <NOSPAM@patchworkmedia.co.uk> wrote in message
news:d4svvc$mbh$1@forums.macromedia.com...> Hi,
> I have a recordset loop which has a nested loop, which checks the value
> against an array of postcodes.. incrementing a counter by one when it
> finds a match..
>
> However I also need to increment a counter when it doesn't find a match...
>
> the problem is however, that obviously whilst this sub-loop is going, it
> is constantly finding no match so my "nomatch" figure is totally
> incorrect..
>
> Instead of adding one when the only thing left is that there isn't a
> match, it is obviously adding one everytime it doesn't find a match which
> isn't what I need..
>
> I know it's prob something to do with stopping the loop, or setting a var
> to True.. but can't get my head round what I should do:
>
> Example:
> 171 records:
>
> Results:
> Scotland: 9
> Wales: 8
> North East: 115
> North West: 10
> Midlands: 7
> Anglia: 3
> South West: 2
> South Central: 4
> SouthEast: 4
> London:
> Other: 20187
>
> See? the Other one is adding loads of counts cos, whilst the sub-loop is
> happening, is adding one everytime,... I don't want this...
>
> Here#s my code:
>
> <%
> For strChart3_i = 1 to arr_PostcodeCount
> If strChart3PostcodeValue = arr_PostcodeCheck(strChart3_i) then
>
> If strChart3_i <= 17 then
> strChart3_Scotland = strChart3_Scotland + 1
> elseif strChart3_i >17 AND strChart3_i <= 23 then
>
> strChart3_Wales = strChart3_Wales + 1
> elseif strChart3_i >23 AND strChart3_i <= 39 then
>
> strChart3_NorthEast = strChart3_NorthEast + 1
> elseif strChart3_i >39 AND strChart3_i <= 54 then
>
> strChart3_NorthWest = strChart3_NorthWest + 1
> elseif strChart3_i >54 AND strChart3_i <= 64 then
>
> strChart3_Midlands = strChart3_Midlands + 1
> elseif strChart3_i >64 AND strChart3_i <= 79 then
>
> strChart3_Anglia = strChart3_Anglia + 1
> elseif strChart3_i >79 AND strChart3_i <= 91 then
>
> strChart3_SouthWest = strChart3_SouthWest + 1
> elseif strChart3_i >91 AND strChart3_i <= 102 then
>
> strChart3_SouthCentral = strChart3_SouthCentral + 1
> elseif strChart3_i >103 AND strChart3_i <= 113 then
>
> strChart3_SouthEast = strChart3_SouthEast + 1
> elseif strChart3_i >113 AND strChart3_i <= 119 then
>
> strChart3_London = strChart3_London + 1
> end if
>
> else
> strChart3_Other = strChart3_Other + 1
> end if
>
> Next
> %>
>
>
> Any ideas?
>
> Cheers
> James
>
Jamesy Guest



Reply With Quote

