|
| |
|
|
mwackers
Posts: 8 Joined: 2/11/2009 Status: offline
|
Returning lower result only - 2/26/2009 11:05:00
I am trying to develop a formula that only returns the lower result for the following: ilot_number = (ilot_sqft / 15000) OR (ilot_frontage / 100) Any help would be appreciated. Entire code <% 'Read in the form field variables Dim ires_zones, iwater_sewer, ilot_sqft, ilot_frontage ires_zones = Request.Form("ires_zones") iwater_sewer = Request.Form("iwater_sewer") ilot_sqft = Request.Form("ilot_sqft") ilot_frontage = Request.Form("ilot_frontage") Dim ilot_number If ires_zones = 1 AND ((ilot_sqft / 15000) < 2) OR ((ilot_frontage / 100) < 2) AND (iwater_sewer = 1) Then ilot_number = "Property can not be subdivided." End If Dim ilot_number If ires_zones = 1 AND ((ilot_sqft / 15000) >= 2) OR ((ilot_frontage / 100) >= 2) AND (iwater_sewer = 1) Then ilot_number = (ilot_sqft / 15000) OR (ilot_frontage / 100) End If %>
|
|
|
|
BeTheBall
Posts: 6502 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Returning lower result only - 2/26/2009 11:41:59
Use the Min function. For example: ilot_number = Min(ilot_sqft / 15000),(ilot_frontage / 100))
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
mwackers
Posts: 8 Joined: 2/11/2009 Status: offline
|
RE: Returning lower result only - 2/26/2009 13:11:32
Thanks for the Min function, but I tried it any for some reason the code won't work. Here is the current version, any suggestions? <% 'Read in the form field variables Dim ires_zones, ilot_sqft, ilot_frontage ires_zones = Request.Form("ires_zones") ilot_sqft = Request.Form("ilot_sqft") ilot_frontage = Request.Form("ilot_frontage") Dim ilot_number If ires_zones = 1 AND ((ilot_sqft / 15000) < 2) OR ((ilot_frontage / 100) < 2) Then ilot_number = "Property can not be subdivided." End If If ires_zones = 1 AND ((ilot_sqft / 15000) >= 2) AND ((ilot_frontage / 100) >= 2) Then ilot_number = Min((ilot_sqft / 15000),(ilot_frontage / 100)) End If If ires_zones = 2 AND ((ilot_sqft / 15000) < 2) OR ((ilot_frontage / 100) < 2) Then ilot_number = "Property can not be subdivided." End If If ires_zones = 2 AND ((ilot_sqft / 15000) >= 2) AND ((ilot_frontage / 100) >= 2) Then ilot_number = Min((ilot_sqft / 15000),(ilot_frontage / 100)) End If If ires_zones = 3 AND ((ilot_sqft / 15000) < 2) OR ((ilot_frontage / 100) < 2) Then ilot_number = "Property can not be subdivided." End If If ires_zones = 3 AND ((ilot_sqft / 15000) >= 2) AND ((ilot_frontage / 100) >= 2) Then ilot_number = Min((ilot_sqft / 15000),(ilot_frontage / 100)) End If If ires_zones = 4 AND ((ilot_sqft / 30000) < 2) OR ((ilot_frontage / 150) < 2) Then ilot_number = "Property can not be subdivided." End If If ires_zones = 4 AND ((ilot_sqft / 30000) >= 2) AND ((ilot_frontage / 150) >= 2) Then ilot_number = Min((ilot_sqft / 30000),(ilot_frontage / 150)) End If If ires_zones = 5 AND ((ilot_sqft / 45000) < 2) OR ((ilot_frontage / 200) < 2) Then ilot_number = "Property can not be subdivided." End If If ires_zones = 5 AND ((ilot_sqft / 45000) >= 2) AND ((ilot_frontage / 200) >= 2) Then ilot_number = Min((ilot_sqft / 45000),(ilot_frontage / 200)) End If If ires_zones = 6 AND ((ilot_sqft / 60000) < 2) OR ((ilot_frontage / 200) < 2) Then ilot_number = "Property can not be subdivided." End If If ires_zones = 6 AND ((ilot_sqft / 60000) >= 2) AND ((ilot_frontage / 200) >= 2) Then ilot_number = Min((ilot_sqft / 60000),(ilot_frontage / 200)) End If %>
|
|
|
|
BeTheBall
Posts: 6502 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Returning lower result only - 2/26/2009 17:22:16
Can you give me more than "the code won't work"? What is happening? Is there an error code?
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
mwackers
Posts: 8 Joined: 2/11/2009 Status: offline
|
RE: Returning lower result only - 2/27/2009 10:23:34
Still no luck. Here is the webpage: http://www.middletownplanning.com/Calculators/calculator_subdivision.asp here is the entire code. <%@ Language=VBSCRIPT %> <% Option Explicit %> <%' BEGIN FUNCTION AREA '* Min ****************************************************** ' Finds and returns the lowest value in an array of numbers. ' Ignores non-numeric and Null data contained in the array. ' Returns Null if no numeric items are found in the array. '************************************************************ Function Min(aNumberArray) Dim I ' Standard loop counter Dim dblLowestSoFar ' Numeric variable for current lowest item ' Init it to Null so I know it's empty dblLowestSoFar = Null ' Loop through the array For I = LBound(aNumberArray) to UBound(aNumberArray) ' Testing line left in for debugging if needed 'Response.Write aNumberArray(I) & "<BR>" ' Check to be sure the item is numeric so we don't bomb out by trying to ' compare a number to a string. If IsNumeric(aNumberArray(I)) Then ' Convert it to a Double for comparison and compare it to previous lowest #. ' If it's lower than the current lowest or the value of dblLowestSoFar is ' still NULL then set dblLowestSoFar to it's new value. If CDbl(aNumberArray(I)) < dblLowestSoFar Or IsNull(dblLowestSoFar) Then dblLowestSoFar = CDbl(aNumberArray(I)) End If End If Next 'I Min = dblLowestSoFar End Function '* Max ****************************************************** 'Finds and returns the highest value in an array of numbers. 'Ignores non-numeric and Null data contained in the array. 'Returns Null if no numeric items are found in the array. '************************************************************ Function Max(aNumberArray) Dim I Dim dblHighestSoFar dblHighestSoFar = Null For I = LBound(aNumberArray) to UBound(aNumberArray) ' Testing line left in for debugging if needed 'Response.Write aNumberArray(I) & "<BR>" If IsNumeric(aNumberArray(I)) Then If CDbl(aNumberArray(I)) > dblHighestSoFar Or IsNull(dblHighestSoFar) Then dblHighestSoFar = CDbl(aNumberArray(I)) End If End If Next 'I Max = dblHighestSoFar End Function ' END FUNCTION AREA %> <% 'Read in the form field variables Dim ires_zones, ilot_sqft, ilot_frontage ires_zones = Request.Form("ires_zones") ilot_sqft = Request.Form("ilot_sqft") ilot_frontage = Request.Form("ilot_frontage") Dim ilot_number If ires_zones = 1 AND ((ilot_sqft / 15000) < 2) OR ((ilot_frontage / 100) < 2) Then ilot_number = "Property can not be subdivided." End If If ires_zones = 1 AND ((ilot_sqft / 15000) >= 2) AND ((ilot_frontage / 100) >= 2) Then ilot_number = Min(Array((ilot_sqft / 15000),(ilot_frontage / 100))) End If If ires_zones = 2 AND ((ilot_sqft / 15000) < 2) OR ((ilot_frontage / 100) < 2) Then ilot_number = "Property can not be subdivided." End If If ires_zones = 2 AND ((ilot_sqft / 15000) >= 2) AND ((ilot_frontage / 100) >= 2) Then ilot_number = Min(Array((ilot_sqft / 15000),(ilot_frontage / 100))) End If If ires_zones = 3 AND ((ilot_sqft / 15000) < 2) OR ((ilot_frontage / 100) < 2) Then ilot_number = "Property can not be subdivided." End If If ires_zones = 3 AND ((ilot_sqft / 15000) >= 2) AND ((ilot_frontage / 100) >= 2) Then ilot_number = Min(Array((ilot_sqft / 15000),(ilot_frontage / 100))) End If If ires_zones = 4 AND ((ilot_sqft / 30000) < 2) OR ((ilot_frontage / 150) < 2) Then ilot_number = "Property can not be subdivided." End If If ires_zones = 4 AND ((ilot_sqft / 30000) >= 2) AND ((ilot_frontage / 150) >= 2) Then ilot_number = Min(Array((ilot_sqft / 30000),(ilot_frontage / 150))) End If If ires_zones = 5 AND ((ilot_sqft / 45000) < 2) OR ((ilot_frontage / 200) < 2) Then ilot_number = "Property can not be subdivided." End If If ires_zones = 5 AND ((ilot_sqft / 45000) >= 2) AND ((ilot_frontage / 200) >= 2) Then ilot_number = Min(Array((ilot_sqft / 45000),(ilot_frontage / 200))) End If If ires_zones = 6 AND ((ilot_sqft / 60000) < 2) OR ((ilot_frontage / 200) < 2) Then ilot_number = "Property can not be subdivided." End If If ires_zones = 6 AND ((ilot_sqft / 60000) >= 2) AND ((ilot_frontage / 200) >= 2) Then ilot_number = Min(Array((ilot_sqft / 60000),(ilot_frontage / 200))) End If %> <html> <head> <meta name="GENERATOR" content="Microsoft FrontPage 5.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>New Page 1</title> </head> <body> <form method="POST" action="http://www.middletownplanning.com/Calculators/calculators_subdivision.asp"> <p> Is a Lot Subdividable Calculator</p> <p>Zone the property is in <select size="1" name="ires_zones"> <option value="1">RPZ</option> <option value="2">R-1</option> <option value="3">R-15</option> <option value="4">R-30</option> <option value="5">R-45</option> <option value="6">R-60</option> </select></p> <p>Access to Public Water and Public Sewer <select size="1" name="iwater_sewer"> <option value="1">Yes, Public Water AND Public Sewer </option> <option value="2">No, Private Well And/Or Private Septic </option> </select></p> <p>Square Feet of Lot <input type="text" name="ilot_sqft" size="16"></p> <p>Feet of Frontage <input type="text" name="ilot_frontage" size="10"></p> <%=ilot_number%><P> Further analysis of topography, soils, wetlands, floodplain, water access, sewer access and other issues need to be studied to determine the actual subdivision potential of such a property.<P> <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p> </form> <P> </body> </html>
< Message edited by mwackers -- 2/27/2009 11:37:45 >
|
|
|
|
mwackers
Posts: 8 Joined: 2/11/2009 Status: offline
|
RE: Returning lower result only - 2/27/2009 15:47:29
Thanks! It works now.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|