|
| |
|
|
charlie df
Posts: 79 From: las vegas nv USA Status: offline
|
unexpected result - 8/21/2001 20:15:00
I am using DRW to get values for the varriables in the script, but I am not getting the result that I thought. Could somebody be kind enough to look at my script and let me know if I am doing something wrong. Below is the script:<% Response.Expires = 0 Dim IDWRank Dim IDLRank Dim RankDiff Dim Move Dim NewRank Dim Match IDWRank = FP_FieldVal(fp_rs,"WinnerRank") IDLRank = FP_FieldVal(fp_rs,"LoserRank") Match = FP_FieldVal(fp_rs,"MatchNumber") If IDWRank > IDLRank Then RankDiff = IDWRank - IDLRank Move = RankDiff / 2 NewRank = IDWRank - Move If Move = .5 Then Response.Write "You and your opponent switched ranks." ElseIf Move > .5 Then Response.Write "You are now ranked number " & (NewRank) & "." End If ElseIf IDLRank > IDWRank Then Response.Write "You don't move up in rank this time. Better luck next time!." End If 'Below was added so that i can check what record was being used. Has no bearing on the formula. Response.Write (Match) & "," Response.Write (IDWRank) & "," Response.Write (IDLRank) %> These are the variables that are being assigned (according to my check) IDWRank=100 IDLRank=40 Match=6 Here I get the mesage "You don't move up in rank this time" With the code below I get the message "You are now ranked number 70." <% Response.Expires = 0 Dim IDWRank Dim IDLRank Dim RankDiff Dim Move Dim NewRank IDWRank = 100 IDLRank = 40 If IDWRank > IDLRank Then RankDiff = IDWRank - IDLRank Move = RankDiff / 2 NewRank = IDWRank - Move If Move = .5 Then Response.Write "You and your opponent switched ranks." ElseIf Move > .5 Then Response.Write "You are now ranked number " & (NewRank) & "." End If ElseIf IDLRank > IDWRank Then Response.Write "You don't move up in rank this time. Better luck next time!." End If %> It looks to me that there is a problem using data from a database to set a variable. Is there a way that I can do this?
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: unexpected result - 8/21/2001 15:54:00
It looks OK to me at first glance - don't want to insult you, but are they number fields in your DB (and not text fields)???
|
|
|
|
charlie df
Posts: 79 From: las vegas nv USA Status: offline
|
RE: unexpected result - 8/21/2001 16:23:00
They are number fields, but depending on what record is being looked at on that page, the numbers for IDWRank and IDLRank will change, otherwise I would just use the constant number, like the sample on the bottom. Any help or comment is not an insult, this is my first VBScript, so it is taken as constructive criticism. I appreciate your help, and hopefully someone may be able to help me find the reason why I'm getting the wrong message.
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: unexpected result - 8/22/2001 20:01:00
Again just guessing, but could it have something to do with fp_FieldVal? Possibly try changing that to FP_Field. See:http://www.frontpagewebmaster.com/ubb/Forum6/HTML/002445.html for other codes. The only other thing I can think of is to possibly DIM your variables as so: <% Response.Expires = 0 Dim IDWRank as Integer Dim IDLRank as Integer Dim RankDiff as Integer Dim Move as Integer Dim NewRank as Integer Dim Match as Integer . . . %>
|
|
|
|
Spooky
Posts: 26617 Joined: 11/11/1998 From: Middle Earth Status: offline
|
RE: unexpected result - 8/22/2001 20:28:00
Yep, go with FP_Field!After that, you can use cInt or cLng, but as they are numerics, you should be ok.
|
|
|
|
charlie df
Posts: 79 From: las vegas nv USA Status: offline
|
RE: unexpected result - 8/22/2001 23:11:00
Actually, it is an incomplete script. i am using a DRW and the values of the DRW, are what I am trying to pass to the script. New to this and got stuck, so I came to the best resource on databases. i will try your suggestions, if I can't follow your instructions I'll return. Thanks for the help, I really do appreciate it.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|