Dividing Variables And Rounding
I'm doing up a stats page for a survey, and this is a small
part of one of the results. Below is part of the code to do
totals/percents. My question is, how do i make it so myAnswer is
written with two decimal places?
Currently, it displays the percent as 4.76190476190476
<%
myAnswer = OneAgree_total / OneTotal_total * 100
Response.Write "" & myAnswer
%>
View Replies
ADVERTISEMENT
How do i make it so i devide all ratings up
eg if there was 7 reviews of 5/5 it would add them all up to 25 and divide by the total number of reviews for that sumision which would be 5
Anyone know ?
View Replies
View Related
I am trying to figure out how to divide longer articles in to separate pages with a "next page" function at the bottom of each page.
Thus far, for my information based website, I have created my database, my Articles.asp page, my Catagory.asp page, and my default.asp and I have built a content editor to enter my articles. And all are working great.
My problem is, I would like to divide my longer articles into smaller pages. I see it all the time on sites...so I can't believe it is that hard. Do I need to divide the articles into "fields" in my database? or is there a way to do it without altering my database?
View Replies
View Related
I have a simple asp page which throws out a list of products on order by Customer X.
As the page writes out the lines, I want to add a Horizontal Rule when the ProductName changes .... i.e. Code:
View Replies
View Related
I need to round off a few fields to 1 or 2 decimal places but if the number is negative, it gives -0.0 or -0.00 after rounding off. Eg. -0.001356 after rounding off to two decimal places gives me -0.00...which is meaningless as -0.00 is useless Also, -0.019 should give -0.02.Tried using FormatNumber and Round functions in VBScript but still it gives the same results.
View Replies
View Related
I have a page in witch 4 or so variables are loaded from a database. They are of currency format and then they are add up to get a total. Problem is that say the total is $6.10 the actual return is rounded down to $ 6.1 . How can I get it to show $6.10 , less rounding ??
View Replies
View Related
i 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.
View Replies
View Related
I'm using asp, obviously, and mysql. My prices are using the decimal field type... what can I do to make it round up the the nearest 5?
View Replies
View Related
I've got this script, and its been giving me this result as seen below. 2 questions I would like to ask..
1. How would I modify the below script in order to round the numbers?. (Script further down.)
2.You see the output result where it says 3268.19?, the white space next to it means the 'Parts' record set is blank but did have a weight value, now how would I substitute the word "NA" for the white space being shown? .....
View Replies
View Related
I'm trying to work out how I can round off a number that the user inputs. I need the number to round up to the nearest 50. For example, if the user enters 234, I want it to round up to 250. If the user enters 51, I want it to round up to 100. Has anyone got any suggestions for coding?
View Replies
View Related
I am working on a shipping calculator, and basically need to round up a number to the nearest 1 and am unsure how to go about it, any ideas?
View Replies
View Related
If CInt(StrFirst) rounds up the value what rounds down the number i.e just show the whole number with out taking in to account anything after the decimal point?
View Replies
View Related
Right now I round my number to 2 decimal places... and since I am dealing with money values I need to show $100.70...but my calculations show $100.7. Is there a way to fix this? How can I tack on a "0" if it only shows 1 decimal place?
View Replies
View Related
I'm trying to calculate two time fields. And when the result is smaller then 15 min, it has to round it to 15 min. Example:
begin time: 14:00
end time: 14:40
(end time - begin time = 40 minutes)
result has to be: 45 minutes
The result wil be shown in a form field. This is the code I'm using (it works fine in my database), perhaps I have to adjust it for asp? But I don't know how. Code:
View Replies
View Related
if i have a value of 11.7908787541713
how could i trim it to 11.79 and how do i round the number up?
View Replies
View Related
Is there a way to round a number that is calculated in an sql statement?
1/25/2006 NT NT 10 NT
1/26/2006 450000 NT 10 NT
1/26/2006 200100 5 NT 5
1/26/2006 50000 5 NT 5
Average 233366.6667 5 10 5
On my average row, i dont want any numbers after the decimal point. My sql is Select AVG(XXX) from `test` Where `XXX` <> -1
View Replies
View Related
how do i round off a number to 2 decimal places? This code taken from www.w3schools.com only round the number to a whole number.
<html>
<body>
<script type="text/vbscript">
i = 48.66776677
j = 48.999
document.write(Round(i))
document.write("<br />")
document.write(Round(j))
</script>
</body>
</html>
View Replies
View Related
I have got the total amount of hours flown in the top left hand side of the home page and it is in hours.
Trouble is the decimal places need to be rounded to 2 as sometimes it says sometihg like 3254.63333333333 hours. I'd like it to say something like 3254.63 instead.. Code:
View Replies
View Related
can anyone help me i want to round off a number entered by a user to two decimal points for a number of text boxes.
View Replies
View Related
I had recently found a function that will write out a currency amount in words. It worked fine until I passed it a variable retreived from the stored procedure.
Well I had to change an "Int()" to "CDbl()" within the function because I got an error: "Variable uses an Automation type not supported in VBScript". I also changed an "(Abs(nAmount)" to an "(Abs(CDbl(nAmount))" because of the same error. Code:
View Replies
View Related
can anyone tell me difference between environment variables and server variables.
View Replies
View Related
I'm not sure how to best describe my problem, so a simple example should help explain things:
I have two arrays, called set1_data and set2_data
if I create a variable like so:
firstPart = "set1"
and then assign like this:
copyOfArray = firstPart & "_data"
how do I make copyOfArray reference the set1_array, as opposed to just a string "set1_array" which is what it's doing?
I've had a good rummage round ye olde Internet but couldn't find anything there must be a keyword or function to achieve this?!?
View Replies
View Related
I am trying to build a web based database using Access and ASP. I can retreive data form the database in a web page. I can send data from one page to another. However, I am stuck trying to figure out how to make the data variable. I would like the second page to display only data the user selected from a drop down list in the previous web page. I tried using the WHERE function and replace the hard coded information with a variable, but it isn't accepting the code. Could someone please help with this? I have research mulitple sites and can't find this particular piece of code or in tutorials. I must be missing something because seems like it would be basic stuff.
View Replies
View Related
I'm trying to reference a username variable that is saved after the user
logs in. I can reference it using $(Username) in standard html parts of the
page but how do i use it in the script sections enclosed with <% %>
View Replies
View Related
How can I get the value of a variable set in ASP from
inside vbscript tags. Here an exampleCode:
<%
Dim x
x = "something"
%>
<script language=vbscript>
msgbox(x)
</script>
I need to display the variable in a msgbox but can within
ASP.
View Replies
View Related
on the page.asp it searches the database for the specific record with id=3.
now i cant use : variable = Request.Form("id"), because the information does not come from a form, and request.querystring doesn't want to work either.
View Replies
View Related
I am new to asp and have tried a few things and cannot get it to work. I thought this code:
<input type="hidden" name="x_cust_id" value="<%= x_email %>">
would work for making the x_cust_id value equal what was put in the x_email field - but that doesnt work - any idea what Im doing wrong.
View Replies
View Related
I have a webpage with a list of items with checkboxes and a submit button. On the click of the submit button, I call a vbscript that loops through the items and put the values of the checked items in an array or string, and then jump to a new page.
Now I either want to send this variable to the new page, or I want to save the values to a mySQL database table, so I can use the values on the new page.
It seems I can't use session variables (session.contents) for this because that's server-side only.
View Replies
View Related
how can we use variables in sql statements
View Replies
View Related
Does anyone know how to get a variable to transfer from ASP.NET to an ASP page?
View Replies
View Related
Is there any way to get input boxes by thier id rather than
thier name? (Request.Form("elementname")) I don't want to
have to give every box its own id and name when they are just
going to be the same.
View Replies
View Related
I know that it's possible to pass more than one url variable using '&' querying 2 columns in the database.However,I want to pass both the words 'piano' and 'keyboard' to the same column [instruments] in a database).
Here is the code for just 'piano' and this works fine.
Search_quick.asp?<%="search="&"piano"%>
This is processed by a request.querystring("search")
View Replies
View Related
I'm building an application that allows visitors to our site to view GPS survey data. The data is collected several times a day and the files written to a different directory each day. Thus, for July, there are 31 folders.
There is a calendar on the site that people can click on the date they want to get the data for. Then, a window will open and the contents of that days directory will be displayed in the window.
Our app is at http://test.c-b.com/CORS/ - the data is supposed to be accessed from the calendar but now all I can do is view the root files. I just can't figure out how to target another directory with the FSO using a variable passed from a querystring.
View Replies
View Related