Forums
This topic is locked
Calculate percentage from two recordsets
Posted 24 Mar 2006 17:22:49
1
has voted
24 Mar 2006 17:22:49 Steve Williamson posted:
I have two recordsets (rsWk) and (rsPvsWk) each pulling a different figure for the field (Mc). I have a separate space on the ASP within another table for logging the percentage increase/decrease between the two. Do I create a text box to display the data in the table?
How do I create this calculation?
I'm not fluent in ASP so I may need help in positioning the code.
Thanks.
Replies
Replied 24 Mar 2006 18:14:08
24 Mar 2006 18:14:08 Simon Bloodworth replied:
you could try something like this:
<%
Dim ObjValue1, ObjValue2
ObjValue1 = (Rs_value1.Fields.Item("value1"
ObjValue2 = (Rs_value2.Fields.Item("value2"
%>
<input name="textfield" type="text" value="<%=(ObjValue1)-(ObjValue2)%>" />
This wont give you the percentage but is a start on how you can subtract one against the other and then look at some other sums to show the percentage difference and have it available in a text field to be then added at a later date to a DB.
hope this helps
Simon
DWMX 2004 | ASP | VBScript
<%
Dim ObjValue1, ObjValue2
ObjValue1 = (Rs_value1.Fields.Item("value1"
ObjValue2 = (Rs_value2.Fields.Item("value2"
%>
<input name="textfield" type="text" value="<%=(ObjValue1)-(ObjValue2)%>" />
This wont give you the percentage but is a start on how you can subtract one against the other and then look at some other sums to show the percentage difference and have it available in a text field to be then added at a later date to a DB.
hope this helps
Simon
DWMX 2004 | ASP | VBScript