Home | Site map   
Home Products Downloads Support Contacts
ASPRunner Pro:  Overview | Try now | Buy now | Tutorial |  How to | Screenshots | Live demo | FAQ | Forum
 
  How to Use Calculated Fields

A calculated field derives its value from some formula involving other fields values. You do not enter data into a calculated field. The program automatically determines the correct value when involved records are changed.
There are two types of calculated fields:

1. Calculated field calculates "on the fly" and doesn't exist in database.
2. Calculated field exists in database and calculates using JavaScript.

1. Calculated field calculates "on the fly" and doesn't exist in database.
- proceed to SQL query tab and check off the Edit SQL query manually box.
- add your query. For example:

Price * Quantity as Total,
Price * 0.05 as Tax

- build project.

How it looks in browser:

2. Calculated field exists in database and calculates using JavaScript.
You can also add values calculated as per some formula to existing field in the database. To do it, you need to make changes in the include/�_aspfunctions.asp and include/jsfunctions.js files.
For example, you need to calculate and add Sum = Price * Quantity. field value to the database
Open jsfunctions.js file and add the following code snippet to the very end of the file:

function UpdateSum()
{
  document.editform.Sum.value = document.editform.Price.value * 
	document.editform.Quantity.value;
}

Open �_aspfunctions.asp file, find BuildEditControl Function, and modify the ASP code in its beginning (see changes in bold):

BuildEditControl =""
	    if sFieldName="Price" or sFieldName="Quantity" then
		  	onchange = " onchange=""UpdateSum();"" "
		end if
Select Case sFormat
 Case EDIT_FORMAT_TEXT_FIELD   		
  BuildEditControl = "<input type=text name=""" & sFieldName  & """"  & _
	GetEditParams(sFieldName) & " value=""" & sDefault & """" & onchange & ">"

After changing Price or Quantity values on the Add/ Edit page value in the Sum field will be changed automatically.

Back to top

 
 

Home | Products | Downloads | Support | Contacts

Customer quotes

Once again I want to tell you how impressive your software is. I am a computer applications teacher in the school so I don't know how much praise from me means to you. All I can tell you is that it is wonderful to find software that is easy to use and works so well.

Ian Roller
Ireland

What I needed to do was build a members log in area for a web site that the user could update as new people joined. He wanted this done in two days. With not much time I downloaded this software and had the lot done in under 3 min. Normal time for this would be about 5 days and even then you would still be debuging your scripts.

Richard Murray
Web developer

Contact us:

Xlinesoft.com
Herndon, VA 20171, USA

  1-888-290-6617
  support@xlinesoft.com

  © 1999 - 2005 XLineSoft. All rights reserved. All comments send to webmaster@xlinesoft.com