This topic is locked
[SOLVED]

 Count and Total in ASPRUnner

6/2/2005 3:54:40 PM
ASPRunnerPro General questions
S
Skynet author

HI:
I will like to know where ASPRunner Pro calculate Count and Total to modify according my rules (like don't count fields with the same information) or to calculate values like:
field D = field A - Field B - Field C without use in SQL string (because I can see the results in List but this values are not stored in database and are calculated on the fly)
Of course I have lot of Ideas that I can use for calculared values, using Custom formulas.
Skynet

Sergey Kornilov admin 6/3/2005

Hi,
you can find Count and Total functionality in LoopRS function in list.asp file.
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_TEXTFIELD   

  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.

S
Skynet author 6/3/2005

Thanks a lot Sergey. I will test your solutions. Will be good if in future versions of ASPRunner PRO you can include custom formulas.
Skynet