Round Function Alternative
Good:
246/10 = 24.6
round(24.6) = 25
Bad:
246/100 = 2.46
round(2.46) = 2 (I want 3)
If I have a decimal, I want to round up. Always. How do I achieve this in ASP?
Good:
246/10 = 24.6
round(24.6) = 25
Bad:
246/100 = 2.46
round(2.46) = 2 (I want 3)
If I have a decimal, I want to round up. Always. How do I achieve this in ASP?
If I have a number that looks like 32.3, 15.5, 30.1 etc, I always assumed Price = Round(Price,2) is actually rounding a figure into a whole number or putting 32.30 etc.
So how do you exactly round the figure to whole number or put a zero at the end of it. I was thinking of formatNumber but I can't remember if there is a function for that?
I have the following equation.
<% varWT = Round(CInt((rsFreePack.Fields.Item("Weight").Value)) +
CInt(Session("w"))) %>
Assume....
Round(CInt((rsFreePack.Fields.Item("Weight").Value)) = .12
CInt(Session("w")) = 30
How can I get it to always ROUND up to 31 ...?
I have a number with a decimal point that i always want to round upwards to the nearest whole number.Now i can use the round(No.) function and this works for any value of .5 and above the problem is the lower .1 .2 .3 .4.So an example
if i get the number 14.2 i want the output to be 15
11.3 = 12
13.8 = 14
If I have a value that is 53.123499999, how can I round it to 53.12?
View Replies View RelatedI have got the following PHP code which I am trying to convert to
ASP.cant find a replace function for Unset in asp which will discard the variable
if ($categoryid == "all")
{
$sql = "SELECT * FROM products where shopinspection=$shopinspection";
unset($HTTP_POST_VARS['categoryid']);
unset($HTTP_POST_VARS['shopinspection']);
}
else
{
$sql = "SELECT * FROM products where categoryid = $categoryid";
unset($HTTP_POST_VARS['categoryid']);
}
unset($HTTP_POST_VARS['Submit']);
while (list($key, $value) = each($HTTP_POST_VARS))
{
if ($value != "" )
{
$sql = $sql .=" AND $key=$value";
//$sql = $sql .=" AND solesource = $solesource";
//echo "<strong>$value</strong>";
I have a variable (ex. 5.66666666) and I want to round it to 2 decimal places. Anyone got this code?
View Replies View RelatedI've created a freight calculator that needs to know how many pallets I'm shipping. I'm using 1 pallet for 750lbs and an extra pallet for anything more than that.
If materialWeight <= 750 Then numPallets = 1 Else numPallets = Round(materialWeight / 750) End If
Now, let's say the materialWeight/750 ends up being 3.2. This is returning 3, but I need it to return 4 since we need an extra pallet.
How can I make it Round up to the next whole number? If it turned out to be an exact number without a decimal then it should stay where it is, but if it's over x.0 at all it should go up to the next whole number.
I'm working on finishing a project the was started by someone else who no longer works here. Its an asp page that takes a whack of numbers form a db, and makes em look all pretty in tables. (its a remake of an excel spreadsheet)
the problem is some of the numbers are not apearing properly. I'm thinking it's because they used Round() sometimes and formatNumber() other times.
the question is... do these functions handle numbers differently? i know formatNumber can do more then just round but i just need it to make the numbers 1 or 2 decimals.
I want to round numbers to include a 0 at the end.
response.write "<td bgcolor=white align=center class=menuText>" & 100 - Round(CTASCAvail,2) & "%</td>"
response.write "<td bgcolor=white align=center class=menuText>" & 100 - Round(Avail,2) & "%</td>"
the following code will round the numbers 2 decimal places but if it is a 0 it will not display it.
Does anyone know how I could round the minutes to the nearest 15 minutes, I'm using this
%=minute(now()) %>
Given: total = 18.01
I use FormatNumber(total,2), it give me 18.01
I use FormatNumber(total,0) it give me 18
I wanna to get 19, how should i do the code?? if there is any decimal
value, i wanna round it up to the next whole number.
I am dividing a value by two .. what i need is to round the number up if it is not a whole number.
View Replies View Relatedi have a very simple question which is driving me nuts. Using the ASP function Round():
Why do BOTH Round(1.775, 2) and Round(1.785, 2) both give the exact same result of 1.78 ?
Surely they should give different results, 1.78 and 1.79 respectively.
for eg x = 3.14. I want to do a round up to 1 decimal. if I were to use round(3.14) , I will get 3.1 , however I want to round up , expecting to get 3.2 .
View Replies View RelatedIn ASP, how do I do this?
Like 1.5 ---> 2
1.001 ---> 2
4.3---> 5
5.0001---> 6
how to round off numbers i have tried 2 different ways but hitting the dead end. say for example the number stored in my variable is
strnum="112"
i want to round it to 115 so my new value will be strnum="115" . so if its 113 it should be rounded to 115 . if its 116 or 117 or 118 or 119 it should be 120 . if its 111 or 112 or 113 it should be 115 . how i can round the numbers.
How can I round the value to the nearest whole number. I have searched on math.round but
can not get it to function. Here is how I am getting the results if not division by zero. Code:
I looped a record set to display and I found a strnage thing. as
Do While NOT rsBinAct.EOF
l_bin = rsBinAct.Fields("o_bin")
l_niin = rsBinAct.Fields("o_bin_niin")
l_b = LEFT(l_niin, 3)
l_n = RIGHT(l_niin, LEN(l_niin)-3 )
' display l_bin, l_b, l_n in a table-like page
rsBinAct.MoveNext
Loop
If I do not set the l_b and l_n to NULL then if the next l_niin is null value, I will get the l_n value of previous one only, l_b is still null. I wonder why.
if there is any alternative software to MS Access for creating .mdb file?
View Replies View RelatedIs is possible to pass parameters with this URL:
www.mysite.com/article/sports/football
instead of the usual method:
http://www.mysite.com/article.asp?c...tegory=football
And, if I need to add more parameters at a later time, may I then use
something like:
http://www.mysite.com/article/sport...321&language=EN
Also, I am using ASP, not ASP.NET.
i have read a few articles saying that you can run IIS on XP home but it does not look too reliable to me and am not too willing to try, so is there an alternative set-up i can use to test my ASP before uploading?
i say this as all ftp hosts seem to want your code pre-tested before uploading .
Looking for a way to switch between submit buttons. The default will be "start" and when the tech clicks on that, the button will start a timer, which I have already set.
The button then will switch to "stop" and when a tech has completed a job and clicks "stop" the timer will also stop and switch the button back to start.
I know how to track the time for each tech that starts and stops a job. I need a jumpstart on how to switch onclicks for two buttons.
I would like to set up an ASP page that sends an e-mail, but the server I'm working on doesn't have CDONTS installed for security reasons. I don't have any control over the server. Are there any alternatives to using CDONTS that will work or a better option?
View Replies View RelatedIs there any other way or trick to include an asp file in my ASP file than the classic html #include. In fact my filename (which is to be included) will be coming from database and #include statement doesn't support any kind of variables.
View Replies View RelatedI know this is not a core .asp issue, but I'll try anyway. I've used the TEXTAREA element for a while, but as you know it's limited when it comes to formating part of the text inside a TEXTAREA.Does anyone have expirience using other text cointainer objects (Java/ActiveX), which is easy to use and easy to read values from when sending a form to a procedure .asp page?
View Replies View Relateddoes someone knows what's the alternative of Iframe. Actually I have to use IFrame and it works in IE but NS 4.74 to NS 4.78 doesn't support IFrame.
So, I have to use alternative of IFrame so that my application can work in both IE and NS 4.74 to NS 4.78
I'm using ASP and I need to generate a ZIP file that contains a list of files that I'm pulling from a database. I've determined WinZip's command line parameters so that I can use it, the problem is I'm unsure how to run WinZip on the server.
Set WshShell = Server.CreateObject("WScript.Shell")
WshShell.Run("c:winzip.exe")
Assuming this would work, how do I get the process to terminate upon completion? I can't have 20-30 WinZip applications running on the server, I need it to handle what I send to it and then close. Maybe I'm taking the entirely wrong approach here.
I'm using the following:
priceDelivered = Round(((totalMaterialPrice + rateWithHandling) / sqFtAmt),2)
It works great except for when it ends in 0, like $4.80. It only prints $4.8.
How can I make sure that even when these numbers end in 0 it shows 2 decimal places?
i am stuck on rounding i have a variable which holds a number like this
a=234.56789
and i want to display only
234
so i did like this
a=Formatnumber(a)
and output is
234.56
but i only need 234
cart_calc_shipping_cost = (Rs.Fields("InitialCost")+(round((Weight/1000)+0.5)-1) * Rs.Fields("AdditionalCost"))
Seems to give me this error:
Microsoft VBScript runtime error '800a005e'
Invalid use of Null: 'round'
I think it is to do with the value of weight, however weight does have to be sometimes 0 so how can i fix this?
I have an asp file that gathers info from a form and sends to the database. im now changing the location of the database from the root path. I think that because of this i cannot use Server.MapPath method of sending data.
Coudl someone please help me out and let me know how i would change the code? Im quite new to this as you could probably see. Code:
Is there an alternative for CDONTS.NewMail for sending email? according to this article , CDONTS.NewMail works only on Windows NT/2000 Operating Systems.
Is there an alternative class that works on Windows XP to send email?