Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 26th, 2003, 04:08 PM
Registered User
 
Join Date: Nov 2003
Location: Huntsville, Tx, USA.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to bful Send a message via AIM to bful Send a message via MSN to bful Send a message via Yahoo to bful
Default Need help multiplying variables

Hi,

We have a page here that delivers a set of scores from variables shown in the code.

I need to multiply the specified raw score variables by "3".
These raw score variables are being called from a SQL db...
Each Total Score is the result of a composite sum. I need to multiply each Total Score discreetly, by calling the Specific Variable Name as it occurs in this query, and then add it to the Overall Total Score.

I am using this to try to multiply the raw score
query = query & "select (sum(var_raw_score)*3) "
(see line 4 of code below to get the context)
I am doing something wrong.

I would like some help verifiying the correct approach to actually multiplying each score by three, and then adding those adjusted scores to the final total.

I know this is basic, but I am also trying to see if there are other issues with the database. I would like to get some input on my approach.

Thanks, as usual, it was due yesterday, day, day. !!

++ CODE ++

if testID = "XYZ" then
    auxscore = 0
    query = ""
    query = query & "select (sum(var_raw_score)*3) "
    '++ original w/o "*3"++ query = query & "select sum(var_raw_score) "
    query = query & " from SESSION_SCORE_VARIABLES "
    query = query & " where session_ID = '" & sessionID & "'"
    query = query & " and (var_name = 'Total Score'"
    query = query & " or var_name = 'Total Raw Score Var1'"
    query = query & " or var_name = 'Total Raw Score Var2')"
    set recset=connectToDB.Execute(query)
    if NOT isnull(recset(0)) then
                        auxscore = auxscore + recset(0)
    end if
    Set recset=nothing
    query = ""
    query = query & "select round(sum(round(cast (var_raw_score as FLOAT)/10,1)),0) "
    'query = query & "select sum(var_raw_score/10) "
    query = query & " from SESSION_SCORE_VARIABLES "
    query = query & " where session_ID = '" & sessionID & "'"
    query = query & " and (var_name = 'Total Score 4'"
    query = query & " or var_name = 'Total Score 5')"
    set recset=connectToDB.Execute(query)
     if NOT isnull(recset(0)) then
         auxscore = auxscore + recset(0)
    end if
    Set recset=nothing
        query = ""
    query = query & "update SESSION_SCORE_VARIABLES "
    query = query & " set var_raw_score = " & auxscore
    query = query & " where session_ID = '" & sessionID & "'"
    query = query & " and var_name = 'Overall Total Score'"
    set recset=connectToDB.Execute(query)
    set recset=nothing

end if

++END CODE++

Should this be in SQL Forum?
Thanks for any help I have tried lots of variations on the live site without much luck.

Bill Fulbright
bfulbright@2100solutions.com
  #2 (permalink)  
Old November 28th, 2003, 11:38 AM
Registered User
 
Join Date: Nov 2003
Location: Huntsville, Tx, USA.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to bful Send a message via AIM to bful Send a message via MSN to bful Send a message via Yahoo to bful
Default

I think we have a problem on the database. The sytax for multiplying is pretty simple, and obviously not the problem.

We believe that the client had a developer who added rowguid, which we did not envision as necessary.

Apparently, this is the block that seems to be preventing the updates to the scores.

Thanks to you all for at least reading.



Bill Fulbright
bfulbright@2100solutions.com


Similar Threads
Thread Thread Starter Forum Replies Last Post
variables daniel.mihalcea Javascript 1 September 9th, 2008 07:06 PM
multiplying columns in a rows then getting sum Condor76 XSLT 9 May 10th, 2007 06:01 PM
using variables webgrphx Classic ASP Basics 3 April 11th, 2007 06:46 PM
Dynamic variables neo_jakey Classic ASP Professional 3 October 20th, 2005 09:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.