Help with this calculation!!!

M

montiy

I'm pulling data from a database, and performing calculations with that data
as it is inserted into a web page. I've got a number of calculations working
correctly; HOWEVER...I have this one pesky calculation that just is NOT
working. I've copied my code (below), if you can take a look...and you can
also check this page out live at http://www.ncsaa.org/stat_leaders_board.asp

(It's the calculation of Save Percentage, using the variables TotalSaves,
TotalGoals, and ShotsFaced, that is causing me problems.)

Thanks...Any help would be great!


-- Nate
---------------------------------

</table>
<p align="center" style="margin-top: 0; margin-bottom: 0">
</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">
<font size="4" color="#0000FF"><b>SAVE PERCENTAGE
(KEEPER)</b></font></p>
<p align="center" style="margin-top: 0; margin-bottom: 0">
<font size="2" color="#0000FF"><b>(Minimum 60 shots
faced)</b></font></p>
<p align="center" style="margin-top: 0; margin-bottom: 0"> <table
width="100%" border="1">
<thead>
<tr>
<th><b>Last Name</b></th>
<th><b>First Name</b></th>
<th><b>Grade</b></th>
<th><b>School</b></th>
<th><b>Saves</b></th>
<th><b>Goals Allowed</b></th>
<th>Save Percentage</th>
</tr>
</thead>
<tbody>
<!--webbot bot="DatabaseRegionStart"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-columntypes="3,202,3,202,202,202,3,3,3,3,3,3,3,202,202,202,135"
s-dataconnection="stat_submission_form_soccer_boys" b-tableformat="TRUE"
b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE"
b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE"
b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource
s-displaycolumns="Last_Name,First_Name,Grade,School,Saves,Goals_Allowed"
s-criteria s-order s-sql="SELECT * FROM Results WHERE (Goals_Allowed + Saves
60) ORDER BY (Saves / (Saves + Goals_Allowed)) DESC" b-procedure="FALSE"
clientside suggestedext="asp" s-defaultfields s-norecordsfound="No records
returned." i-maxrecords="20" i-groupsize="0" botid="20"
u-dblib="_fpclass/fpdblib.inc" u-dbrgn1="_fpclass/fpdbrgn1.inc"
u-dbrgn2="_fpclass/fpdbrgn2.inc" tag="TBODY" preview="<tr><td colspan=64
bgcolor="#FFFF00" width="100%"><font color="#000000">This is the start of a
Database Results region. The page must be fetched from a web server with a
web browser to display correctly; the current web is stored on your local
disk or network.</font></td></tr>" startspan --><!--#include
file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database
Results component on this page is unable to display database content. The
page must have a filename ending in '.asp', and the web must be hosted on a
server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Results WHERE (Goals_Allowed + Saves > 60) ORDER BY
(Saves / (Saves + Goals_Allowed)) DESC"
fp_sDefault=""
fp_sNoRecords="<tr><td colspan=6 align=""LEFT"" width=""100%"">No records
returned.</td></tr>"
fp_sDataConn="stat_submission_form_soccer_boys"
fp_iMaxRecords=20
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue="
fp_sColTypes="&ID=3&School=202&HS_Enrollment=3&Last_Name=202&First_Name=202&Grade=202&Games_Played=3&Shots_At_Goal=3&Goals_Scored=3&Assists=3&Goals_Allowed=3&Saves=3&Shutouts=3&Remote_computer_name=202&User_name=202&Browser_type=202&Timestamp=135&"
fp_iDisplayCols=6
fp_fCustomQuery=True
BOTID=20
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="40941" --><tr>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Last_Name" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE" clientside b-MenuFormat preview="<font
size="-1">&lt;&lt;</font>Last_Name<font size="-1">&gt;&gt;</font>" startspan
--><%=FP_FieldVal(fp_rs,"Last_Name")%><!--webbot bot="DatabaseResultColumn"
endspan i-checksum="17991" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="First_Name" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE" clientside b-MenuFormat preview="<font
size="-1">&lt;&lt;</font>First_Name<font size="-1">&gt;&gt;</font>" startspan
--><%=FP_FieldVal(fp_rs,"First_Name")%><!--webbot bot="DatabaseResultColumn"
endspan i-checksum="27645" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Grade" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE"
clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Grade<font
size="-1">&gt;&gt;</font>" startspan
--><%=FP_FieldVal(fp_rs,"Grade")%><!--webbot bot="DatabaseResultColumn"
endspan i-checksum="9058" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="School" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE"
clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>School<font
size="-1">&gt;&gt;</font>" startspan
--><%=FP_FieldVal(fp_rs,"School")%><!--webbot bot="DatabaseResultColumn"
endspan i-checksum="14919" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Saves" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE"
clientside b-MenuFormat preview="<font size="-1">&lt;&lt;</font>Saves<font
size="-1">&gt;&gt;</font>" startspan
--><%=FP_FieldVal(fp_rs,"Saves")%><!--webbot bot="DatabaseResultColumn"
endspan i-checksum="7729" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Goals_Allowed" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE" clientside b-MenuFormat preview="<font
size="-1">&lt;&lt;</font>Goals_Allowed<font size="-1">&gt;&gt;</font>"
startspan --><%=FP_FieldVal(fp_rs,"Goals_Allowed")%><!--webbot
bot="DatabaseResultColumn" endspan i-checksum="35843" --></font></td>
<td align="center"><font
size="2"> <%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves / ShotsFaced%></font></td>
</tr>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE"
b-menuformat="FALSE" u-dbrgn2="_fpclass/fpdbrgn2.inc" i-groupsize="0"
clientside tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00"
width="100%"><font color="#000000">This is the end of a Database Results
region.</font></td></tr>" startspan --><!--#include
file="_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="62730" --></tbody>
 
D

David Berry

In looking at the site it looks like you're not formatting the result as a
percent. Ex:

Format(myVariable,'##0.00##%') as newVariable
 
M

montiy

I can do the percent formatting (though it's not done on that page).

What's causing me problems is the following calculation:

<%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves / ShotsFaced%>

Can you look it over to see if there is anything obvious that I'm doing
wrong. I'm using TotalGoals, TotalSaves, and ShotsFaced as variables in the
calculation. "Saves" and "Goals_Allowed" are database fields.



-- Nate
 
T

Trevor L.

The calculation works fine

I put this into an .asp page
<%
TotalGoals=200
TotalSaves=25
ShotsFaced=TotalGoals+TotalSaves
If ShotsFaced < 1 Then ShotsFaced = 1
Response.Write TotalSaves / ShotsFaced%>
and I got the answer
0.111111111111111

You say that you have handled translating it into a percentage, so it all
looks OK
 
S

Stefan B Rusynko

See my response to your other post on your ASP error

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


|I can do the percent formatting (though it's not done on that page).
|
| What's causing me problems is the following calculation:
|
| <%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
| ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves / ShotsFaced%>
|
| Can you look it over to see if there is anything obvious that I'm doing
| wrong. I'm using TotalGoals, TotalSaves, and ShotsFaced as variables in the
| calculation. "Saves" and "Goals_Allowed" are database fields.
|
|
|
| -- Nate
|
|
| "David Berry" wrote:
|
| > In looking at the site it looks like you're not formatting the result as a
| > percent. Ex:
| >
| > Format(myVariable,'##0.00##%') as newVariable
| >
| >
| > | > > I'm pulling data from a database, and performing calculations with that
| > > data
| > > as it is inserted into a web page. I've got a number of calculations
| > > working
| > > correctly; HOWEVER...I have this one pesky calculation that just is NOT
| > > working. I've copied my code (below), if you can take a look...and you
| > > can
| > > also check this page out live at
| > > http://www.ncsaa.org/stat_leaders_board.asp
| > >
| > > (It's the calculation of Save Percentage, using the variables TotalSaves,
| > > TotalGoals, and ShotsFaced, that is causing me problems.)
| > >
| > > Thanks...Any help would be great!
| > >
| > >
| > > -- Nate
| > > ---------------------------------
| > >
| > > </table>
| > > <p align="center" style="margin-top: 0; margin-bottom: 0">
| > > </p>
| > > <p align="center" style="margin-top: 0; margin-bottom: 0">
| > > <font size="4" color="#0000FF"><b>SAVE PERCENTAGE
| > > (KEEPER)</b></font></p>
| > > <p align="center" style="margin-top: 0; margin-bottom: 0">
| > > <font size="2" color="#0000FF"><b>(Minimum 60 shots
| > > faced)</b></font></p>
| > > <p align="center" style="margin-top: 0; margin-bottom: 0"> <table
| > > width="100%" border="1">
| > > <thead>
| > > <tr>
| > > <th><b>Last Name</b></th>
| > > <th><b>First Name</b></th>
| > > <th><b>Grade</b></th>
| > > <th><b>School</b></th>
| > > <th><b>Saves</b></th>
| > > <th><b>Goals Allowed</b></th>
| > > <th>Save Percentage</th>
| > > </tr>
| > > </thead>
| > > <tbody>
| > > <!--webbot bot="DatabaseRegionStart"
| > >
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
| > > s-columntypes="3,202,3,202,202,202,3,3,3,3,3,3,3,202,202,202,135"
| > > s-dataconnection="stat_submission_form_soccer_boys" b-tableformat="TRUE"
| > > b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE"
| > > b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE"
| > > b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource
| > > s-displaycolumns="Last_Name,First_Name,Grade,School,Saves,Goals_Allowed"
| > > s-criteria s-order s-sql="SELECT * FROM Results WHERE (Goals_Allowed +
| > > Saves
| > >> 60) ORDER BY (Saves / (Saves + Goals_Allowed)) DESC" b-procedure="FALSE"
| > > clientside suggestedext="asp" s-defaultfields s-norecordsfound="No records
| > > returned." i-maxrecords="20" i-groupsize="0" botid="20"
| > > u-dblib="_fpclass/fpdblib.inc" u-dbrgn1="_fpclass/fpdbrgn1.inc"
| > > u-dbrgn2="_fpclass/fpdbrgn2.inc" tag="TBODY" preview="<tr><td colspan=64
| > > bgcolor="#FFFF00" width="100%"><font color="#000000">This is the start of
| > > a
| > > Database Results region. The page must be fetched from a web server with a
| > > web browser to display correctly; the current web is stored on your local
| > > disk or network.</font></td></tr>" startspan --><!--#include
| > > file="_fpclass/fpdblib.inc"-->
| > > <% if 0 then %>
| > > <SCRIPT Language="JavaScript">
| > > document.write("<div style='background: yellow; color: black;'>The
| > > Database
| > > Results component on this page is unable to display database content. The
| > > page must have a filename ending in '.asp', and the web must be hosted on
| > > a
| > > server that supports Active Server Pages.</div>");
| > > </SCRIPT>
| > > <% end if %>
| > > <%
| > > fp_sQry="SELECT * FROM Results WHERE (Goals_Allowed + Saves > 60) ORDER
| > > BY
| > > (Saves / (Saves + Goals_Allowed)) DESC"
| > > fp_sDefault=""
| > > fp_sNoRecords="<tr><td colspan=6 align=""LEFT"" width=""100%"">No records
| > > returned.</td></tr>"
| > > fp_sDataConn="stat_submission_form_soccer_boys"
| > > fp_iMaxRecords=20
| > > fp_iCommandType=1
| > > fp_iPageSize=0
| > > fp_fTableFormat=True
| > > fp_fMenuFormat=False
| > > fp_sMenuChoice=""
| > > fp_sMenuValue=""
| > >
fp_sColTypes="&ID=3&School=202&HS_Enrollment=3&Last_Name=202&First_Name=202&Grade=202&Games_Played=3&Shots_At_Goal=3&Goals_Scored=3&Assists=3&Goals_Allowed=3&Saves=3&Shutouts=3&Remote_computer_name=202&User_name=202&Browser_type=202&Timestamp=135&"
| > > fp_iDisplayCols=6
| > > fp_fCustomQuery=True
| > > BOTID=20
| > > fp_iRegion=BOTID
| > > %>
| > > <!--#include file="_fpclass/fpdbrgn1.inc"-->
| > > <!--webbot bot="DatabaseRegionStart" endspan i-checksum="40941" --><tr>
| > > <td align="center"><font size="2">
| > > <!--webbot bot="DatabaseResultColumn"
| > >
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
| > > s-column="Last_Name" b-tableformat="TRUE" b-hashtml="FALSE"
| > > b-makelink="FALSE" clientside b-MenuFormat preview="<font
| > > size="-1"><<</font>Last_Name<font size="-1">>></font>"
| > > startspan
| > > --><%=FP_FieldVal(fp_rs,"Last_Name")%><!--webbot
| > > bot="DatabaseResultColumn"
| > > endspan i-checksum="17991" --></font></td>
| > > <td align="center"><font size="2">
| > > <!--webbot bot="DatabaseResultColumn"
| > >
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
| > > s-column="First_Name" b-tableformat="TRUE" b-hashtml="FALSE"
| > > b-makelink="FALSE" clientside b-MenuFormat preview="<font
| > > size="-1"><<</font>First_Name<font size="-1">>></font>"
| > > startspan
| > > --><%=FP_FieldVal(fp_rs,"First_Name")%><!--webbot
| > > bot="DatabaseResultColumn"
| > > endspan i-checksum="27645" --></font></td>
| > > <td align="center"><font size="2">
| > > <!--webbot bot="DatabaseResultColumn"
| > >
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
| > > s-column="Grade" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE"
| > > clientside b-MenuFormat preview="<font size="-1"><<</font>Grade<font
| > > size="-1">>></font>" startspan
| > > --><%=FP_FieldVal(fp_rs,"Grade")%><!--webbot bot="DatabaseResultColumn"
| > > endspan i-checksum="9058" --></font></td>
| > > <td align="center"><font size="2">
| > > <!--webbot bot="DatabaseResultColumn"
| > >
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
| > > s-column="School" b-tableformat="TRUE" b-hashtml="FALSE"
| > > b-makelink="FALSE"
| > > clientside b-MenuFormat preview="<font
| > > size="-1"><<</font>School<font
| > > size="-1">>></font>" startspan
| > > --><%=FP_FieldVal(fp_rs,"School")%><!--webbot bot="DatabaseResultColumn"
| > > endspan i-checksum="14919" --></font></td>
| > > <td align="center"><font size="2">
| > > <!--webbot bot="DatabaseResultColumn"
| > >
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
| > > s-column="Saves" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE"
| > > clientside b-MenuFormat preview="<font size="-1"><<</font>Saves<font
| > > size="-1">>></font>" startspan
| > > --><%=FP_FieldVal(fp_rs,"Saves")%><!--webbot bot="DatabaseResultColumn"
| > > endspan i-checksum="7729" --></font></td>
| > > <td align="center"><font size="2">
| > > <!--webbot bot="DatabaseResultColumn"
| > >
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
| > > s-column="Goals_Allowed" b-tableformat="TRUE" b-hashtml="FALSE"
| > > b-makelink="FALSE" clientside b-MenuFormat preview="<font
| > > size="-1"><<</font>Goals_Allowed<font size="-1">>></font>"
| > > startspan --><%=FP_FieldVal(fp_rs,"Goals_Allowed")%><!--webbot
| > > bot="DatabaseResultColumn" endspan i-checksum="35843" --></font></td>
| > > <td align="center"><font
| > > size="2">
| > >
<%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
| > > ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves /
| > > ShotsFaced%></font></td>
| > > </tr>
| > > <!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE"
| > > b-menuformat="FALSE" u-dbrgn2="_fpclass/fpdbrgn2.inc" i-groupsize="0"
| > > clientside tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00"
| > > width="100%"><font color="#000000">This is the end of a Database Results
| > > region.</font></td></tr>" startspan --><!--#include
| > > file="_fpclass/fpdbrgn2.inc"-->
| > > <!--webbot bot="DatabaseRegionEnd" endspan i-checksum="62730" --></tbody>
| > >
| > >
| > >
| > >
| > >
| > >
| >
| >
| >
 
M

montiy

I basically have the same code...but mine is not working. My code (again) is:

<%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves / ShotsFaced%>

Check out my result (not yet formatted for percent) on my web site:

http://www.ncsaa.org/stat_leaders_board.asp

(Scroll down to SAVE PERCENTAGE under BOYS' SOCCER.)

Any ideas?!?

-- Nate


Trevor L. said:
The calculation works fine

I put this into an .asp page
<%
TotalGoals=200
TotalSaves=25
ShotsFaced=TotalGoals+TotalSaves
If ShotsFaced < 1 Then ShotsFaced = 1
Response.Write TotalSaves / ShotsFaced%>
and I got the answer
0.111111111111111

You say that you have handled translating it into a percentage, so it all
looks OK
--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/

montiy said:
I can do the percent formatting (though it's not done on that page).

What's causing me problems is the following calculation:

<%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves / ShotsFaced%>

Can you look it over to see if there is anything obvious that I'm doing
wrong. I'm using TotalGoals, TotalSaves, and ShotsFaced as variables in
the
calculation. "Saves" and "Goals_Allowed" are database fields.



-- Nate
 
T

Trevor L.

It is difficult without seeing the ASP code. I can't figure out what
calculation is based on; the elements are not (or may not be) displayed

As I said, the code I posted worked.

Would you cut the ASP code and post it back here.

--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/
I basically have the same code...but mine is not working. My code
(again) is:

<%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves / ShotsFaced%>

Check out my result (not yet formatted for percent) on my web site:

http://www.ncsaa.org/stat_leaders_board.asp

(Scroll down to SAVE PERCENTAGE under BOYS' SOCCER.)

Any ideas?!?

-- Nate

Trevor L. said:
The calculation works fine

I put this into an .asp page
<%
TotalGoals=200
TotalSaves=25
ShotsFaced=TotalGoals+TotalSaves
If ShotsFaced < 1 Then ShotsFaced = 1
Response.Write TotalSaves / ShotsFaced%>
and I got the answer
0.111111111111111

You say that you have handled translating it into a percentage, so
it all looks OK
--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/

montiy said:
I can do the percent formatting (though it's not done on that page).

What's causing me problems is the following calculation:

<%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves / ShotsFaced%>

Can you look it over to see if there is anything obvious that I'm
doing wrong. I'm using TotalGoals, TotalSaves, and ShotsFaced as
variables in the
calculation. "Saves" and "Goals_Allowed" are database fields.



-- Nate


:

In looking at the site it looks like you're not formatting the
result as a
percent. Ex:

Format(myVariable,'##0.00##%') as newVariable


I'm pulling data from a database, and performing calculations
with that data
as it is inserted into a web page. I've got a number of
calculations working
correctly; HOWEVER...I have this one pesky calculation that just
is NOT working. I've copied my code (below), if you can take a
look...and you can
also check this page out live at
http://www.ncsaa.org/stat_leaders_board.asp

(It's the calculation of Save Percentage, using the variables
TotalSaves,
TotalGoals, and ShotsFaced, that is causing me problems.)

Thanks...Any help would be great!


-- Nate
---------------------------------

</table>
<p align="center" style="margin-top: 0; margin-bottom: 0">
</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">
<font size="4" color="#0000FF"><b>SAVE PERCENTAGE
(KEEPER)</b></font></p>
<p align="center" style="margin-top: 0; margin-bottom:
0"> <font size="2" color="#0000FF"><b>(Minimum 60 shots
faced)</b></font></p>
<p align="center" style="margin-top: 0; margin-bottom:
0"> <table
width="100%" border="1">
<thead>
<tr>
<th><b>Last Name</b></th>
<th><b>First Name</b></th>
<th><b>Grade</b></th>
<th><b>School</b></th>
<th><b>Saves</b></th>
<th><b>Goals Allowed</b></th>
<th>Save Percentage</th>
</tr>
</thead>
<tbody>
<!--webbot bot="DatabaseRegionStart"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-columntypes="3,202,3,202,202,202,3,3,3,3,3,3,3,202,202,202,135"
s-dataconnection="stat_submission_form_soccer_boys"
b-tableformat="TRUE"
b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE"
b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE"
b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE"
s-recordsource
s-displaycolumns="Last_Name,First_Name,Grade,School,Saves,Goals_Allowed"
s-criteria s-order s-sql="SELECT * FROM Results WHERE
(Goals_Allowed + Saves
60) ORDER BY (Saves / (Saves + Goals_Allowed)) DESC"
b-procedure="FALSE"
clientside suggestedext="asp" s-defaultfields s-norecordsfound="No
records
returned." i-maxrecords="20" i-groupsize="0" botid="20"
u-dblib="_fpclass/fpdblib.inc" u-dbrgn1="_fpclass/fpdbrgn1.inc"
u-dbrgn2="_fpclass/fpdbrgn2.inc" tag="TBODY" preview="<tr><td
colspan=64
bgcolor="#FFFF00" width="100%"><font color="#000000">This is the
start of
a
Database Results region. The page must be fetched from a web
server with a
web browser to display correctly; the current web is stored on
your local
disk or network.</font></td></tr>" startspan --><!--#include
file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The
Database
Results component on this page is unable to display database
content. The
page must have a filename ending in '.asp', and the web must be
hosted on
a
server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Results WHERE (Goals_Allowed + Saves > 60)
ORDER
BY
(Saves / (Saves + Goals_Allowed)) DESC"
fp_sDefault=""
fp_sNoRecords="<tr><td colspan=6 align=""LEFT"" width=""100%"">No
records
returned.</td></tr>"
fp_sDataConn="stat_submission_form_soccer_boys"
fp_iMaxRecords=20
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&ID=3&School=202&HS_Enrollment=3&Last_Name=202&First_Name=202&Grade=202&Games_Played=3&Shots_At_Goal=3&Goals_Scored=3&Assists=3&Goals_Allowed=3&Saves=3&Shutouts=3&Remote_computer_name=202&User_name=202&Browser_type=202&Timestamp=135&"
fp_iDisplayCols=6
fp_fCustomQuery=True
BOTID=20
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="40941"
--><tr> <td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Last_Name" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE" clientside b-MenuFormat preview="<font
size="-1"><<</font>Last_Name<font size="-1">>></font>"
startspan
--><%=FP_FieldVal(fp_rs,"Last_Name")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="17991" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="First_Name" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE" clientside b-MenuFormat preview="<font
size="-1"><<</font>First_Name<font size="-1">>></font>"
startspan
--><%=FP_FieldVal(fp_rs,"First_Name")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="27645" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Grade" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE"
clientside b-MenuFormat preview="<font
size="-1"><<</font>Grade<font size="-1">>></font>" startspan
--><%=FP_FieldVal(fp_rs,"Grade")%><!--webbot
bot="DatabaseResultColumn" endspan i-checksum="9058"
--></font></td> <td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="School" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE"
clientside b-MenuFormat preview="<font
size="-1"><<</font>School<font
size="-1">>></font>" startspan
--><%=FP_FieldVal(fp_rs,"School")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="14919" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Saves" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE"
clientside b-MenuFormat preview="<font
size="-1"><<</font>Saves<font size="-1">>></font>" startspan
--><%=FP_FieldVal(fp_rs,"Saves")%><!--webbot
bot="DatabaseResultColumn" endspan i-checksum="7729"
--></font></td> <td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Goals_Allowed" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE" clientside b-MenuFormat preview="<font
size="-1"><<</font>Goals_Allowed<font size="-1">>></font>"
startspan --><%=FP_FieldVal(fp_rs,"Goals_Allowed")%><!--webbot
bot="DatabaseResultColumn" endspan i-checksum="35843"
--></font></td> <td align="center"><font
size="2">
<%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves /
ShotsFaced%></font></td>
</tr>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE"
b-menuformat="FALSE" u-dbrgn2="_fpclass/fpdbrgn2.inc"
i-groupsize="0" clientside tag="TBODY" preview="<tr><td
colspan=64 bgcolor="#FFFF00" width="100%"><font
color="#000000">This is the end of a Database Results
region.</font></td></tr>" startspan --><!--#include
file="_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan
i-checksum="62730" --></tbody>
 
D

David Berry

It may just be the way you have the code lines set up. Try this:

<%
TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")
TotalSaves=FP_FieldVal(fp_rs,"Saves")
ShotsFaced= TotalGoals+TotalSaves
if ShotsFaced < 1 Then
ShotsFaced = 1
end if
%>

<%=TotalSaves / ShotsFaced%>

If that doesn't work try replacing:

ShotsFaced= TotalGoals+TotalSaves

with

ShotsFaced = CInt(TotalGoals) + CInt(TotalSaves)


To further narrow down the problem you can add some "debugging" using
Response.Write to see if the variables are holding the right values and then
you might be able to see where the problem is. For example:


<%
TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")

' Value of TotalGoals
Response.Write "TotalGoals = " & " " & TotalGoals

TotalSaves=FP_FieldVal(fp_rs,"Saves")

' Value of TotalSaves
Response.Write "TotalSaves = " & " " & TotalSaves

ShotsFaced= TotalGoals+TotalSaves

' Value of ShotsFaced
Response.Write "ShotsFaced = " & " " & ShotsFaced

if ShotsFaced < 1 Then
ShotsFaced = 1
end if

' NEW Value of ShotsFaced after the IF statement. Will either be 1 or the
value from the Saves field
Response.Write "ShotsFaced = " & " " & ShotsFaced
%>


See if all the numbers displayed are correct. If not let us know what value
is wrong.




montiy said:
I basically have the same code...but mine is not working. My code (again)
is:

<%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves / ShotsFaced%>

Check out my result (not yet formatted for percent) on my web site:

http://www.ncsaa.org/stat_leaders_board.asp

(Scroll down to SAVE PERCENTAGE under BOYS' SOCCER.)

Any ideas?!?

-- Nate


Trevor L. said:
The calculation works fine

I put this into an .asp page
<%
TotalGoals=200
TotalSaves=25
ShotsFaced=TotalGoals+TotalSaves
If ShotsFaced < 1 Then ShotsFaced = 1
Response.Write TotalSaves / ShotsFaced%>
and I got the answer
0.111111111111111

You say that you have handled translating it into a percentage, so it all
looks OK
--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/

montiy said:
I can do the percent formatting (though it's not done on that page).

What's causing me problems is the following calculation:

<%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves / ShotsFaced%>

Can you look it over to see if there is anything obvious that I'm doing
wrong. I'm using TotalGoals, TotalSaves, and ShotsFaced as variables
in
the
calculation. "Saves" and "Goals_Allowed" are database fields.



-- Nate


:

In looking at the site it looks like you're not formatting the result
as
a
percent. Ex:

Format(myVariable,'##0.00##%') as newVariable


I'm pulling data from a database, and performing calculations with
that
data
as it is inserted into a web page. I've got a number of
calculations
working
correctly; HOWEVER...I have this one pesky calculation that just is
NOT
working. I've copied my code (below), if you can take a look...and
you
can
also check this page out live at
http://www.ncsaa.org/stat_leaders_board.asp

(It's the calculation of Save Percentage, using the variables
TotalSaves,
TotalGoals, and ShotsFaced, that is causing me problems.)

Thanks...Any help would be great!


-- Nate
---------------------------------

</table>
<p align="center" style="margin-top: 0; margin-bottom: 0">
</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">
<font size="4" color="#0000FF"><b>SAVE PERCENTAGE
(KEEPER)</b></font></p>
<p align="center" style="margin-top: 0; margin-bottom: 0">
<font size="2" color="#0000FF"><b>(Minimum 60 shots
faced)</b></font></p>
<p align="center" style="margin-top: 0; margin-bottom: 0">
<table
width="100%" border="1">
<thead>
<tr>
<th><b>Last Name</b></th>
<th><b>First Name</b></th>
<th><b>Grade</b></th>
<th><b>School</b></th>
<th><b>Saves</b></th>
<th><b>Goals Allowed</b></th>
<th>Save Percentage</th>
</tr>
</thead>
<tbody>
<!--webbot bot="DatabaseRegionStart"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-columntypes="3,202,3,202,202,202,3,3,3,3,3,3,3,202,202,202,135"
s-dataconnection="stat_submission_form_soccer_boys"
b-tableformat="TRUE"
b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE"
b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE"
b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE"
s-recordsource
s-displaycolumns="Last_Name,First_Name,Grade,School,Saves,Goals_Allowed"
s-criteria s-order s-sql="SELECT * FROM Results WHERE (Goals_Allowed
+
Saves
60) ORDER BY (Saves / (Saves + Goals_Allowed)) DESC"
b-procedure="FALSE"
clientside suggestedext="asp" s-defaultfields s-norecordsfound="No
records
returned." i-maxrecords="20" i-groupsize="0" botid="20"
u-dblib="_fpclass/fpdblib.inc" u-dbrgn1="_fpclass/fpdbrgn1.inc"
u-dbrgn2="_fpclass/fpdbrgn2.inc" tag="TBODY" preview="<tr><td
colspan=64
bgcolor="#FFFF00" width="100%"><font color="#000000">This is the
start
of
a
Database Results region. The page must be fetched from a web server
with a
web browser to display correctly; the current web is stored on your
local
disk or network.</font></td></tr>" startspan --><!--#include
file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The
Database
Results component on this page is unable to display database
content.
The
page must have a filename ending in '.asp', and the web must be
hosted
on
a
server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Results WHERE (Goals_Allowed + Saves > 60)
ORDER
BY
(Saves / (Saves + Goals_Allowed)) DESC"
fp_sDefault=""
fp_sNoRecords="<tr><td colspan=6 align=""LEFT"" width=""100%"">No
records
returned.</td></tr>"
fp_sDataConn="stat_submission_form_soccer_boys"
fp_iMaxRecords=20
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&ID=3&School=202&HS_Enrollment=3&Last_Name=202&First_Name=202&Grade=202&Games_Played=3&Shots_At_Goal=3&Goals_Scored=3&Assists=3&Goals_Allowed=3&Saves=3&Shutouts=3&Remote_computer_name=202&User_name=202&Browser_type=202&Timestamp=135&"
fp_iDisplayCols=6
fp_fCustomQuery=True
BOTID=20
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan
i-checksum="40941" --><tr>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Last_Name" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE" clientside b-MenuFormat preview="<font
size="-1"><<</font>Last_Name<font size="-1">>></font>"
startspan
--><%=FP_FieldVal(fp_rs,"Last_Name")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="17991" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="First_Name" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE" clientside b-MenuFormat preview="<font
size="-1"><<</font>First_Name<font size="-1">>></font>"
startspan
--><%=FP_FieldVal(fp_rs,"First_Name")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="27645" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Grade" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE"
clientside b-MenuFormat preview="<font size="-1"><<</font>Grade<font
size="-1">>></font>" startspan
--><%=FP_FieldVal(fp_rs,"Grade")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="9058" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="School" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE"
clientside b-MenuFormat preview="<font
size="-1"><<</font>School<font
size="-1">>></font>" startspan
--><%=FP_FieldVal(fp_rs,"School")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="14919" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Saves" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE"
clientside b-MenuFormat preview="<font size="-1"><<</font>Saves<font
size="-1">>></font>" startspan
--><%=FP_FieldVal(fp_rs,"Saves")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="7729" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Goals_Allowed" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE" clientside b-MenuFormat preview="<font
size="-1"><<</font>Goals_Allowed<font size="-1">>></font>"
startspan --><%=FP_FieldVal(fp_rs,"Goals_Allowed")%><!--webbot
bot="DatabaseResultColumn" endspan
i-checksum="35843" --></font></td>
<td align="center"><font
size="2">
<%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves /
ShotsFaced%></font></td>
</tr>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE"
b-menuformat="FALSE" u-dbrgn2="_fpclass/fpdbrgn2.inc"
i-groupsize="0"
clientside tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00"
width="100%"><font color="#000000">This is the end of a Database
Results
region.</font></td></tr>" startspan --><!--#include
file="_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan
i-checksum="62730" --></tbody>
 
M

montiy

Whoa! The CInt method worked. What in the world is CInt? It must be
miracle language!

Seriously, though, I'd like to know what that does -- and why that may have
solved my problem.

Thanks a bunch!!!


-- Nate


David Berry said:
It may just be the way you have the code lines set up. Try this:

<%
TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")
TotalSaves=FP_FieldVal(fp_rs,"Saves")
ShotsFaced= TotalGoals+TotalSaves
if ShotsFaced < 1 Then
ShotsFaced = 1
end if
%>

<%=TotalSaves / ShotsFaced%>

If that doesn't work try replacing:

ShotsFaced= TotalGoals+TotalSaves

with

ShotsFaced = CInt(TotalGoals) + CInt(TotalSaves)


To further narrow down the problem you can add some "debugging" using
Response.Write to see if the variables are holding the right values and then
you might be able to see where the problem is. For example:


<%
TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")

' Value of TotalGoals
Response.Write "TotalGoals = " & " " & TotalGoals

TotalSaves=FP_FieldVal(fp_rs,"Saves")

' Value of TotalSaves
Response.Write "TotalSaves = " & " " & TotalSaves

ShotsFaced= TotalGoals+TotalSaves

' Value of ShotsFaced
Response.Write "ShotsFaced = " & " " & ShotsFaced

if ShotsFaced < 1 Then
ShotsFaced = 1
end if

' NEW Value of ShotsFaced after the IF statement. Will either be 1 or the
value from the Saves field
Response.Write "ShotsFaced = " & " " & ShotsFaced
%>


See if all the numbers displayed are correct. If not let us know what value
is wrong.




montiy said:
I basically have the same code...but mine is not working. My code (again)
is:

<%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves / ShotsFaced%>

Check out my result (not yet formatted for percent) on my web site:

http://www.ncsaa.org/stat_leaders_board.asp

(Scroll down to SAVE PERCENTAGE under BOYS' SOCCER.)

Any ideas?!?

-- Nate


Trevor L. said:
The calculation works fine

I put this into an .asp page
<%
TotalGoals=200
TotalSaves=25
ShotsFaced=TotalGoals+TotalSaves
If ShotsFaced < 1 Then ShotsFaced = 1
Response.Write TotalSaves / ShotsFaced%>
and I got the answer
0.111111111111111

You say that you have handled translating it into a percentage, so it all
looks OK
--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/

I can do the percent formatting (though it's not done on that page).

What's causing me problems is the following calculation:

<%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves / ShotsFaced%>

Can you look it over to see if there is anything obvious that I'm doing
wrong. I'm using TotalGoals, TotalSaves, and ShotsFaced as variables
in
the
calculation. "Saves" and "Goals_Allowed" are database fields.



-- Nate


:

In looking at the site it looks like you're not formatting the result
as
a
percent. Ex:

Format(myVariable,'##0.00##%') as newVariable


I'm pulling data from a database, and performing calculations with
that
data
as it is inserted into a web page. I've got a number of
calculations
working
correctly; HOWEVER...I have this one pesky calculation that just is
NOT
working. I've copied my code (below), if you can take a look...and
you
can
also check this page out live at
http://www.ncsaa.org/stat_leaders_board.asp

(It's the calculation of Save Percentage, using the variables
TotalSaves,
TotalGoals, and ShotsFaced, that is causing me problems.)

Thanks...Any help would be great!


-- Nate
---------------------------------

</table>
<p align="center" style="margin-top: 0; margin-bottom: 0">
</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">
<font size="4" color="#0000FF"><b>SAVE PERCENTAGE
(KEEPER)</b></font></p>
<p align="center" style="margin-top: 0; margin-bottom: 0">
<font size="2" color="#0000FF"><b>(Minimum 60 shots
faced)</b></font></p>
<p align="center" style="margin-top: 0; margin-bottom: 0">
<table
width="100%" border="1">
<thead>
<tr>
<th><b>Last Name</b></th>
<th><b>First Name</b></th>
<th><b>Grade</b></th>
<th><b>School</b></th>
<th><b>Saves</b></th>
<th><b>Goals Allowed</b></th>
<th>Save Percentage</th>
</tr>
</thead>
<tbody>
<!--webbot bot="DatabaseRegionStart"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-columntypes="3,202,3,202,202,202,3,3,3,3,3,3,3,202,202,202,135"
s-dataconnection="stat_submission_form_soccer_boys"
b-tableformat="TRUE"
b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE"
b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE"
b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE"
s-recordsource
s-displaycolumns="Last_Name,First_Name,Grade,School,Saves,Goals_Allowed"
s-criteria s-order s-sql="SELECT * FROM Results WHERE (Goals_Allowed
+
Saves
60) ORDER BY (Saves / (Saves + Goals_Allowed)) DESC"
b-procedure="FALSE"
clientside suggestedext="asp" s-defaultfields s-norecordsfound="No
records
returned." i-maxrecords="20" i-groupsize="0" botid="20"
u-dblib="_fpclass/fpdblib.inc" u-dbrgn1="_fpclass/fpdbrgn1.inc"
u-dbrgn2="_fpclass/fpdbrgn2.inc" tag="TBODY" preview="<tr><td
colspan=64
bgcolor="#FFFF00" width="100%"><font color="#000000">This is the
start
of
a
Database Results region. The page must be fetched from a web server
with a
web browser to display correctly; the current web is stored on your
local
disk or network.</font></td></tr>" startspan --><!--#include
file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The
Database
Results component on this page is unable to display database
content.
The
page must have a filename ending in '.asp', and the web must be
hosted
on
a
server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Results WHERE (Goals_Allowed + Saves > 60)
ORDER
BY
(Saves / (Saves + Goals_Allowed)) DESC"
fp_sDefault=""
fp_sNoRecords="<tr><td colspan=6 align=""LEFT"" width=""100%"">No
records
returned.</td></tr>"
fp_sDataConn="stat_submission_form_soccer_boys"
fp_iMaxRecords=20
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&ID=3&School=202&HS_Enrollment=3&Last_Name=202&First_Name=202&Grade=202&Games_Played=3&Shots_At_Goal=3&Goals_Scored=3&Assists=3&Goals_Allowed=3&Saves=3&Shutouts=3&Remote_computer_name=202&User_name=202&Browser_type=202&Timestamp=135&"
fp_iDisplayCols=6
fp_fCustomQuery=True
BOTID=20
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan
i-checksum="40941" --><tr>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Last_Name" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE" clientside b-MenuFormat preview="<font
size="-1"><<</font>Last_Name<font size="-1">>></font>"
startspan
--><%=FP_FieldVal(fp_rs,"Last_Name")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="17991" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="First_Name" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE" clientside b-MenuFormat preview="<font
size="-1"><<</font>First_Name<font size="-1">>></font>"
startspan
--><%=FP_FieldVal(fp_rs,"First_Name")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="27645" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Grade" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE"
clientside b-MenuFormat preview="<font size="-1"><<</font>Grade<font
size="-1">>></font>" startspan
--><%=FP_FieldVal(fp_rs,"Grade")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="9058" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="School" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE"
clientside b-MenuFormat preview="<font
size="-1"><<</font>School<font
size="-1">>></font>" startspan
--><%=FP_FieldVal(fp_rs,"School")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="14919" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Saves" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE"
clientside b-MenuFormat preview="<font size="-1"><<</font>Saves<font
size="-1">>></font>" startspan
--><%=FP_FieldVal(fp_rs,"Saves")%><!--webbot
 
T

Trevor L.

montiy said:
Whoa! The CInt method worked. What in the world is CInt? It must be
miracle language!

Seriously, though, I'd like to know what that does -- and why that
may have solved my problem.

Thanks a bunch!!!


-- Nate

Well, David gave lots of good ideas. More than I would have thought of.

Any way, here is a reference to CInt
http://www.w3schools.com/vbscript/func_cint.asp

It converts a number to integer. But I would have to study the code to see
why it made a difference.

Glad that it did, however
 
D

David Berry

Glad it helped. CInt converts the number to an Integer. Sometimes, when
you pull from a database you have to make sure that the values you're
working with are in the right format (especially when doing math). For
example, CInt converts to an Integer, CDbl makes a Double, CStr makes it a
String


montiy said:
Whoa! The CInt method worked. What in the world is CInt? It must be
miracle language!

Seriously, though, I'd like to know what that does -- and why that may
have
solved my problem.

Thanks a bunch!!!


-- Nate


David Berry said:
It may just be the way you have the code lines set up. Try this:

<%
TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")
TotalSaves=FP_FieldVal(fp_rs,"Saves")
ShotsFaced= TotalGoals+TotalSaves
if ShotsFaced < 1 Then
ShotsFaced = 1
end if
%>

<%=TotalSaves / ShotsFaced%>

If that doesn't work try replacing:

ShotsFaced= TotalGoals+TotalSaves

with

ShotsFaced = CInt(TotalGoals) + CInt(TotalSaves)


To further narrow down the problem you can add some "debugging" using
Response.Write to see if the variables are holding the right values and
then
you might be able to see where the problem is. For example:


<%
TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")

' Value of TotalGoals
Response.Write "TotalGoals = " & " " & TotalGoals

TotalSaves=FP_FieldVal(fp_rs,"Saves")

' Value of TotalSaves
Response.Write "TotalSaves = " & " " & TotalSaves

ShotsFaced= TotalGoals+TotalSaves

' Value of ShotsFaced
Response.Write "ShotsFaced = " & " " & ShotsFaced

if ShotsFaced < 1 Then
ShotsFaced = 1
end if

' NEW Value of ShotsFaced after the IF statement. Will either be 1 or
the
value from the Saves field
Response.Write "ShotsFaced = " & " " & ShotsFaced
%>


See if all the numbers displayed are correct. If not let us know what
value
is wrong.




montiy said:
I basically have the same code...but mine is not working. My code
(again)
is:

<%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves / ShotsFaced%>

Check out my result (not yet formatted for percent) on my web site:

http://www.ncsaa.org/stat_leaders_board.asp

(Scroll down to SAVE PERCENTAGE under BOYS' SOCCER.)

Any ideas?!?

-- Nate


:

The calculation works fine

I put this into an .asp page
<%
TotalGoals=200
TotalSaves=25
ShotsFaced=TotalGoals+TotalSaves
If ShotsFaced < 1 Then ShotsFaced = 1
Response.Write TotalSaves / ShotsFaced%>
and I got the answer
0.111111111111111

You say that you have handled translating it into a percentage, so it
all
looks OK
--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/

I can do the percent formatting (though it's not done on that page).

What's causing me problems is the following calculation:

<%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves / ShotsFaced%>

Can you look it over to see if there is anything obvious that I'm
doing
wrong. I'm using TotalGoals, TotalSaves, and ShotsFaced as
variables
in
the
calculation. "Saves" and "Goals_Allowed" are database fields.



-- Nate


:

In looking at the site it looks like you're not formatting the
result
as
a
percent. Ex:

Format(myVariable,'##0.00##%') as newVariable


I'm pulling data from a database, and performing calculations
with
that
data
as it is inserted into a web page. I've got a number of
calculations
working
correctly; HOWEVER...I have this one pesky calculation that just
is
NOT
working. I've copied my code (below), if you can take a
look...and
you
can
also check this page out live at
http://www.ncsaa.org/stat_leaders_board.asp

(It's the calculation of Save Percentage, using the variables
TotalSaves,
TotalGoals, and ShotsFaced, that is causing me problems.)

Thanks...Any help would be great!


-- Nate
---------------------------------

</table>
<p align="center" style="margin-top: 0; margin-bottom: 0">
</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">
<font size="4" color="#0000FF"><b>SAVE PERCENTAGE
(KEEPER)</b></font></p>
<p align="center" style="margin-top: 0; margin-bottom:
0">
<font size="2" color="#0000FF"><b>(Minimum 60 shots
faced)</b></font></p>
<p align="center" style="margin-top: 0; margin-bottom:
0">
<table
width="100%" border="1">
<thead>
<tr>
<th><b>Last Name</b></th>
<th><b>First Name</b></th>
<th><b>Grade</b></th>
<th><b>School</b></th>
<th><b>Saves</b></th>
<th><b>Goals Allowed</b></th>
<th>Save Percentage</th>
</tr>
</thead>
<tbody>
<!--webbot bot="DatabaseRegionStart"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-columntypes="3,202,3,202,202,202,3,3,3,3,3,3,3,202,202,202,135"
s-dataconnection="stat_submission_form_soccer_boys"
b-tableformat="TRUE"
b-menuformat="FALSE" s-menuchoice s-menuvalue
b-tableborder="TRUE"
b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE"
b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE"
s-recordsource
s-displaycolumns="Last_Name,First_Name,Grade,School,Saves,Goals_Allowed"
s-criteria s-order s-sql="SELECT * FROM Results WHERE
(Goals_Allowed
+
Saves
60) ORDER BY (Saves / (Saves + Goals_Allowed)) DESC"
b-procedure="FALSE"
clientside suggestedext="asp" s-defaultfields
s-norecordsfound="No
records
returned." i-maxrecords="20" i-groupsize="0" botid="20"
u-dblib="_fpclass/fpdblib.inc" u-dbrgn1="_fpclass/fpdbrgn1.inc"
u-dbrgn2="_fpclass/fpdbrgn2.inc" tag="TBODY" preview="<tr><td
colspan=64
bgcolor="#FFFF00" width="100%"><font color="#000000">This is the
start
of
a
Database Results region. The page must be fetched from a web
server
with a
web browser to display correctly; the current web is stored on
your
local
disk or network.</font></td></tr>" startspan --><!--#include
file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color:
black;'>The
Database
Results component on this page is unable to display database
content.
The
page must have a filename ending in '.asp', and the web must be
hosted
on
a
server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Results WHERE (Goals_Allowed + Saves >
60)
ORDER
BY
(Saves / (Saves + Goals_Allowed)) DESC"
fp_sDefault=""
fp_sNoRecords="<tr><td colspan=6 align=""LEFT"" width=""100%"">No
records
returned.</td></tr>"
fp_sDataConn="stat_submission_form_soccer_boys"
fp_iMaxRecords=20
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&ID=3&School=202&HS_Enrollment=3&Last_Name=202&First_Name=202&Grade=202&Games_Played=3&Shots_At_Goal=3&Goals_Scored=3&Assists=3&Goals_Allowed=3&Saves=3&Shutouts=3&Remote_computer_name=202&User_name=202&Browser_type=202&Timestamp=135&"
fp_iDisplayCols=6
fp_fCustomQuery=True
BOTID=20
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan
i-checksum="40941" --><tr>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Last_Name" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE" clientside b-MenuFormat preview="<font
size="-1"><<</font>Last_Name<font size="-1">>></font>"
startspan
--><%=FP_FieldVal(fp_rs,"Last_Name")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="17991" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="First_Name" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE" clientside b-MenuFormat preview="<font
size="-1"><<</font>First_Name<font size="-1">>></font>"
startspan
--><%=FP_FieldVal(fp_rs,"First_Name")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="27645" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Grade" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE"
clientside b-MenuFormat preview="<font
size="-1"><<</font>Grade<font
size="-1">>></font>" startspan
--><%=FP_FieldVal(fp_rs,"Grade")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="9058" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="School" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE"
clientside b-MenuFormat preview="<font
size="-1"><<</font>School<font
size="-1">>></font>" startspan
--><%=FP_FieldVal(fp_rs,"School")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="14919" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Saves" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE"
clientside b-MenuFormat preview="<font
size="-1"><<</font>Saves<font
size="-1">>></font>" startspan
--><%=FP_FieldVal(fp_rs,"Saves")%><!--webbot
 
D

David Berry

Just to clarify, what I meant to say was that (in addition to values from a
database) when using Variables, you want to make sure that the variable is
holding the right "type" of information, such as an Integer, Double, String
etc before trying to do math on it, format it etc.

Also, there is a range limitation for this function: -32,768 to 32,767. If
any number beyond this range is passed as argument, run-time error
"Overflow" will occur. If the value must be a number between -2147483648 and
2147483647 then you'd use CLng to convert it to a Long.

You could also do a check to determine if a value is numeric with
IsNumeric() For example,

if IsNumeric(n) then ...

Some commonly used functions are

CLng - Long
CBool - Boolean
CCur - Currency
CDate - Date
CDbl - Double
CStr - String

Finally, another way to make sure your variables are always holding the type
of information that you want is to declare it up front. Ex:

Dim x as Integer
Dim y as String
Dim z as Double

HTH

David Berry said:
Glad it helped. CInt converts the number to an Integer. Sometimes, when
you pull from a database you have to make sure that the values you're
working with are in the right format (especially when doing math). For
example, CInt converts to an Integer, CDbl makes a Double, CStr makes it a
String


montiy said:
Whoa! The CInt method worked. What in the world is CInt? It must be
miracle language!

Seriously, though, I'd like to know what that does -- and why that may
have
solved my problem.

Thanks a bunch!!!


-- Nate


David Berry said:
It may just be the way you have the code lines set up. Try this:

<%
TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")
TotalSaves=FP_FieldVal(fp_rs,"Saves")
ShotsFaced= TotalGoals+TotalSaves
if ShotsFaced < 1 Then
ShotsFaced = 1
end if
%>

<%=TotalSaves / ShotsFaced%>

If that doesn't work try replacing:

ShotsFaced= TotalGoals+TotalSaves

with

ShotsFaced = CInt(TotalGoals) + CInt(TotalSaves)


To further narrow down the problem you can add some "debugging" using
Response.Write to see if the variables are holding the right values and
then
you might be able to see where the problem is. For example:


<%
TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")

' Value of TotalGoals
Response.Write "TotalGoals = " & " " & TotalGoals

TotalSaves=FP_FieldVal(fp_rs,"Saves")

' Value of TotalSaves
Response.Write "TotalSaves = " & " " & TotalSaves

ShotsFaced= TotalGoals+TotalSaves

' Value of ShotsFaced
Response.Write "ShotsFaced = " & " " & ShotsFaced

if ShotsFaced < 1 Then
ShotsFaced = 1
end if

' NEW Value of ShotsFaced after the IF statement. Will either be 1 or
the
value from the Saves field
Response.Write "ShotsFaced = " & " " & ShotsFaced
%>


See if all the numbers displayed are correct. If not let us know what
value
is wrong.




I basically have the same code...but mine is not working. My code
(again)
is:

<%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves / ShotsFaced%>

Check out my result (not yet formatted for percent) on my web site:

http://www.ncsaa.org/stat_leaders_board.asp

(Scroll down to SAVE PERCENTAGE under BOYS' SOCCER.)

Any ideas?!?

-- Nate


:

The calculation works fine

I put this into an .asp page
<%
TotalGoals=200
TotalSaves=25
ShotsFaced=TotalGoals+TotalSaves
If ShotsFaced < 1 Then ShotsFaced = 1
Response.Write TotalSaves / ShotsFaced%>
and I got the answer
0.111111111111111

You say that you have handled translating it into a percentage, so it
all
looks OK
--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/

I can do the percent formatting (though it's not done on that page).

What's causing me problems is the following calculation:

<%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves / ShotsFaced%>

Can you look it over to see if there is anything obvious that I'm
doing
wrong. I'm using TotalGoals, TotalSaves, and ShotsFaced as
variables
in
the
calculation. "Saves" and "Goals_Allowed" are database fields.



-- Nate


:

In looking at the site it looks like you're not formatting the
result
as
a
percent. Ex:

Format(myVariable,'##0.00##%') as newVariable


I'm pulling data from a database, and performing calculations
with
that
data
as it is inserted into a web page. I've got a number of
calculations
working
correctly; HOWEVER...I have this one pesky calculation that just
is
NOT
working. I've copied my code (below), if you can take a
look...and
you
can
also check this page out live at
http://www.ncsaa.org/stat_leaders_board.asp

(It's the calculation of Save Percentage, using the variables
TotalSaves,
TotalGoals, and ShotsFaced, that is causing me problems.)

Thanks...Any help would be great!


-- Nate
---------------------------------

</table>
<p align="center" style="margin-top: 0; margin-bottom: 0">
</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">
<font size="4" color="#0000FF"><b>SAVE PERCENTAGE
(KEEPER)</b></font></p>
<p align="center" style="margin-top: 0; margin-bottom:
0">
<font size="2" color="#0000FF"><b>(Minimum 60 shots
faced)</b></font></p>
<p align="center" style="margin-top: 0; margin-bottom:
0">
<table
width="100%" border="1">
<thead>
<tr>
<th><b>Last Name</b></th>
<th><b>First Name</b></th>
<th><b>Grade</b></th>
<th><b>School</b></th>
<th><b>Saves</b></th>
<th><b>Goals Allowed</b></th>
<th>Save Percentage</th>
</tr>
</thead>
<tbody>
<!--webbot bot="DatabaseRegionStart"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-columntypes="3,202,3,202,202,202,3,3,3,3,3,3,3,202,202,202,135"
s-dataconnection="stat_submission_form_soccer_boys"
b-tableformat="TRUE"
b-menuformat="FALSE" s-menuchoice s-menuvalue
b-tableborder="TRUE"
b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE"
b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE"
s-recordsource
s-displaycolumns="Last_Name,First_Name,Grade,School,Saves,Goals_Allowed"
s-criteria s-order s-sql="SELECT * FROM Results WHERE
(Goals_Allowed
+
Saves
60) ORDER BY (Saves / (Saves + Goals_Allowed)) DESC"
b-procedure="FALSE"
clientside suggestedext="asp" s-defaultfields
s-norecordsfound="No
records
returned." i-maxrecords="20" i-groupsize="0" botid="20"
u-dblib="_fpclass/fpdblib.inc" u-dbrgn1="_fpclass/fpdbrgn1.inc"
u-dbrgn2="_fpclass/fpdbrgn2.inc" tag="TBODY" preview="<tr><td
colspan=64
bgcolor="#FFFF00" width="100%"><font color="#000000">This is the
start
of
a
Database Results region. The page must be fetched from a web
server
with a
web browser to display correctly; the current web is stored on
your
local
disk or network.</font></td></tr>" startspan --><!--#include
file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color:
black;'>The
Database
Results component on this page is unable to display database
content.
The
page must have a filename ending in '.asp', and the web must be
hosted
on
a
server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Results WHERE (Goals_Allowed + Saves >
60)
ORDER
BY
(Saves / (Saves + Goals_Allowed)) DESC"
fp_sDefault=""
fp_sNoRecords="<tr><td colspan=6 align=""LEFT""
width=""100%"">No
records
returned.</td></tr>"
fp_sDataConn="stat_submission_form_soccer_boys"
fp_iMaxRecords=20
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&ID=3&School=202&HS_Enrollment=3&Last_Name=202&First_Name=202&Grade=202&Games_Played=3&Shots_At_Goal=3&Goals_Scored=3&Assists=3&Goals_Allowed=3&Saves=3&Shutouts=3&Remote_computer_name=202&User_name=202&Browser_type=202&Timestamp=135&"
fp_iDisplayCols=6
fp_fCustomQuery=True
BOTID=20
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan
i-checksum="40941" --><tr>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Last_Name" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE" clientside b-MenuFormat preview="<font
size="-1"><<</font>Last_Name<font size="-1">>></font>"
startspan
--><%=FP_FieldVal(fp_rs,"Last_Name")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="17991" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="First_Name" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE" clientside b-MenuFormat preview="<font
size="-1"><<</font>First_Name<font size="-1">>></font>"
startspan
--><%=FP_FieldVal(fp_rs,"First_Name")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="27645" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Grade" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE"
clientside b-MenuFormat preview="<font
size="-1"><<</font>Grade<font
size="-1">>></font>" startspan
--><%=FP_FieldVal(fp_rs,"Grade")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="9058" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="School" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE"
clientside b-MenuFormat preview="<font
size="-1"><<</font>School<font
size="-1">>></font>" startspan
--><%=FP_FieldVal(fp_rs,"School")%><!--webbot
bot="DatabaseResultColumn"
endspan i-checksum="14919" --></font></td>
<td align="center"><font size="2">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-column="Saves" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE"
clientside b-MenuFormat preview="<font
size="-1"><<</font>Saves<font
size="-1">>></font>" startspan
--><%=FP_FieldVal(fp_rs,"Saves")%><!--webbot
 
M

montiy

More good stuff! Thanks, everyone, for taking the time to teach a novice.

-- Nate


David Berry said:
Just to clarify, what I meant to say was that (in addition to values from a
database) when using Variables, you want to make sure that the variable is
holding the right "type" of information, such as an Integer, Double, String
etc before trying to do math on it, format it etc.

Also, there is a range limitation for this function: -32,768 to 32,767. If
any number beyond this range is passed as argument, run-time error
"Overflow" will occur. If the value must be a number between -2147483648 and
2147483647 then you'd use CLng to convert it to a Long.

You could also do a check to determine if a value is numeric with
IsNumeric() For example,

if IsNumeric(n) then ...

Some commonly used functions are

CLng - Long
CBool - Boolean
CCur - Currency
CDate - Date
CDbl - Double
CStr - String

Finally, another way to make sure your variables are always holding the type
of information that you want is to declare it up front. Ex:

Dim x as Integer
Dim y as String
Dim z as Double

HTH

David Berry said:
Glad it helped. CInt converts the number to an Integer. Sometimes, when
you pull from a database you have to make sure that the values you're
working with are in the right format (especially when doing math). For
example, CInt converts to an Integer, CDbl makes a Double, CStr makes it a
String


montiy said:
Whoa! The CInt method worked. What in the world is CInt? It must be
miracle language!

Seriously, though, I'd like to know what that does -- and why that may
have
solved my problem.

Thanks a bunch!!!


-- Nate


:

It may just be the way you have the code lines set up. Try this:

<%
TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")
TotalSaves=FP_FieldVal(fp_rs,"Saves")
ShotsFaced= TotalGoals+TotalSaves
if ShotsFaced < 1 Then
ShotsFaced = 1
end if
%>

<%=TotalSaves / ShotsFaced%>

If that doesn't work try replacing:

ShotsFaced= TotalGoals+TotalSaves

with

ShotsFaced = CInt(TotalGoals) + CInt(TotalSaves)


To further narrow down the problem you can add some "debugging" using
Response.Write to see if the variables are holding the right values and
then
you might be able to see where the problem is. For example:


<%
TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")

' Value of TotalGoals
Response.Write "TotalGoals = " & " " & TotalGoals

TotalSaves=FP_FieldVal(fp_rs,"Saves")

' Value of TotalSaves
Response.Write "TotalSaves = " & " " & TotalSaves

ShotsFaced= TotalGoals+TotalSaves

' Value of ShotsFaced
Response.Write "ShotsFaced = " & " " & ShotsFaced

if ShotsFaced < 1 Then
ShotsFaced = 1
end if

' NEW Value of ShotsFaced after the IF statement. Will either be 1 or
the
value from the Saves field
Response.Write "ShotsFaced = " & " " & ShotsFaced
%>


See if all the numbers displayed are correct. If not let us know what
value
is wrong.




I basically have the same code...but mine is not working. My code
(again)
is:

<%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves / ShotsFaced%>

Check out my result (not yet formatted for percent) on my web site:

http://www.ncsaa.org/stat_leaders_board.asp

(Scroll down to SAVE PERCENTAGE under BOYS' SOCCER.)

Any ideas?!?

-- Nate


:

The calculation works fine

I put this into an .asp page
<%
TotalGoals=200
TotalSaves=25
ShotsFaced=TotalGoals+TotalSaves
If ShotsFaced < 1 Then ShotsFaced = 1
Response.Write TotalSaves / ShotsFaced%>
and I got the answer
0.111111111111111

You say that you have handled translating it into a percentage, so it
all
looks OK
--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/

I can do the percent formatting (though it's not done on that page).

What's causing me problems is the following calculation:

<%TotalGoals=FP_FieldVal(fp_rs,"Goals_Allowed")%><%TotalSaves=FP_FieldVal(fp_rs,"Saves")%><%ShotsFaced=TotalGoals+TotalSaves%><%If
ShotsFaced < 1 Then ShotsFaced = 1%><%=TotalSaves / ShotsFaced%>

Can you look it over to see if there is anything obvious that I'm
doing
wrong. I'm using TotalGoals, TotalSaves, and ShotsFaced as
variables
in
the
calculation. "Saves" and "Goals_Allowed" are database fields.



-- Nate


:

In looking at the site it looks like you're not formatting the
result
as
a
percent. Ex:

Format(myVariable,'##0.00##%') as newVariable


I'm pulling data from a database, and performing calculations
with
that
data
as it is inserted into a web page. I've got a number of
calculations
working
correctly; HOWEVER...I have this one pesky calculation that just
is
NOT
working. I've copied my code (below), if you can take a
look...and
you
can
also check this page out live at
http://www.ncsaa.org/stat_leaders_board.asp

(It's the calculation of Save Percentage, using the variables
TotalSaves,
TotalGoals, and ShotsFaced, that is causing me problems.)

Thanks...Any help would be great!


-- Nate
---------------------------------

</table>
<p align="center" style="margin-top: 0; margin-bottom: 0">
</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">
<font size="4" color="#0000FF"><b>SAVE PERCENTAGE
(KEEPER)</b></font></p>
<p align="center" style="margin-top: 0; margin-bottom:
0">
<font size="2" color="#0000FF"><b>(Minimum 60 shots
faced)</b></font></p>
<p align="center" style="margin-top: 0; margin-bottom:
0">
<table
width="100%" border="1">
<thead>
<tr>
<th><b>Last Name</b></th>
<th><b>First Name</b></th>
<th><b>Grade</b></th>
<th><b>School</b></th>
<th><b>Saves</b></th>
<th><b>Goals Allowed</b></th>
<th>Save Percentage</th>
</tr>
</thead>
<tbody>
<!--webbot bot="DatabaseRegionStart"
s-columnnames="ID,School,HS_Enrollment,Last_Name,First_Name,Grade,Games_Played,Shots_At_Goal,Goals_Scored,Assists,Goals_Allowed,Saves,Shutouts,Remote_computer_name,User_name,Browser_type,Timestamp"
s-columntypes="3,202,3,202,202,202,3,3,3,3,3,3,3,202,202,202,135"
s-dataconnection="stat_submission_form_soccer_boys"
b-tableformat="TRUE"
b-menuformat="FALSE" s-menuchoice s-menuvalue
b-tableborder="TRUE"
b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE"
b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE"
s-recordsource
s-displaycolumns="Last_Name,First_Name,Grade,School,Saves,Goals_Allowed"
s-criteria s-order s-sql="SELECT * FROM Results WHERE
(Goals_Allowed
+
Saves
60) ORDER BY (Saves / (Saves + Goals_Allowed)) DESC"
b-procedure="FALSE"
clientside suggestedext="asp" s-defaultfields
s-norecordsfound="No
records
returned." i-maxrecords="20" i-groupsize="0" botid="20"
u-dblib="_fpclass/fpdblib.inc" u-dbrgn1="_fpclass/fpdbrgn1.inc"
u-dbrgn2="_fpclass/fpdbrgn2.inc" tag="TBODY" preview="<tr><td
colspan=64
bgcolor="#FFFF00" width="100%"><font color="#000000">This is the
start
of
a
Database Results region. The page must be fetched from a web
server
with a
web browser to display correctly; the current web is stored on
your
local
disk or network.</font></td></tr>" startspan --><!--#include
file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color:
black;'>The
Database
Results component on this page is unable to display database
content.
The
page must have a filename ending in '.asp', and the web must be
hosted
on
a
 
M

montiy

OK...I've got a whole new problem now, if you're still willing to help...

I'm trying to accomplish the following:

1) The web page pulls three fields from a database into which the user is
entering data. (I've put validation forms on the entry form to be sure that
the user is entering minutes as an integer between greater than zero, seconds
as an integer between 0 and 59, and hundredths as an integer between 0 and
99.)

2) The three variables (Minutes50FreeBoys, Seconds50FreeBoys, and
Hundredths50FreeBoys) are assigned to the three database field values.

3) I want the results (when displayed in a table column that I've created)
to be displayed like such: "1:03.05" (for minutes, seconds, and hundredths of
a second). THUS...I need to be sure that the "seconds" field and the
"hundredths" field are both displayed as TWO DIGITS. So, I've tried to use
if/then statements to change any single-digits numbers (0 through 9) to
double-digits ("00", "01", "02", etc).

4) Then I want the result to display in the following format:

Minutes:Seconds.Hundredths (ex: 2:05.73)

Printed here is my current code. I'm GUESSING that I'm going wrong
somewhere in the handling of my variables (maybe in the if/then statements
where I'm changing a number to a text value?). I'd appreciate any help that
you're able to give...Thanks!

-- Nate

---------------------------

<%
Minutes50FreeBoys=FPFieldVal(fp_rs,"Minutes_Freestyle50yd")
Seconds50FreeBoys=FP_FieldVal(fp_rs,"Seconds_Freestyle50yd")
Hundredths50FreeBoys=FP_FieldVal(fp_rs,"Hundredths_Freestyle50yd")
If Seconds50FreeBoys=0 Then Seconds50FreeBoys="00"
If Seconds50FreeBoys=1 Then Seconds50FreeBoys="01"
If Seconds50FreeBoys=2 Then Seconds50FreeBoys="02"
If Seconds50FreeBoys=3 Then Seconds50FreeBoys="03"
If Seconds50FreeBoys=4 Then Seconds50FreeBoys="04"
If Seconds50FreeBoys=5 Then Seconds50FreeBoys="05"
If Seconds50FreeBoys=6 Then Seconds50FreeBoys="06"
If Seconds50FreeBoys=7 Then Seconds50FreeBoys="07"
If Seconds50FreeBoys=8 Then Seconds50FreeBoys="08"
If Seconds50FreeBoys=9 Then Seconds50FreeBoys="09"
If Hundredths50FreeBoys=0 Then Hundredths50FreeBoys="00"
If Hundredths50FreeBoys=1 Then Hundredths50FreeBoys="01"
If Hundredths50FreeBoys=2 Then Hundredths50FreeBoys="02"
If Hundredths50FreeBoys=3 Then Hundredths50FreeBoys="03"
If Hundredths50FreeBoys=4 Then Hundredths50FreeBoys="04"
If Hundredths50FreeBoys=5 Then Hundredths50FreeBoys="05"
If Hundredths50FreeBoys=6 Then Hundredths50FreeBoys="06"
If Hundredths50FreeBoys=7 Then Hundredths50FreeBoys="07"
If Hundredths50FreeBoys=8 Then Hundredths50FreeBoys="08"
If Hundredths50FreeBoys=9 Then Hundredths50FreeBoys="09"
%>
<%
=Minutes50FreeBoys & ":" Seconds50FreeBoys & "." & Hundredths50FreeBoys
%>
 
M

montiy

....OR...would it work better to bypass all the If/Then statements and just
attempt to display the variable as a Double? (I'm guessing a "Double" is a
two-digit number?)

I tried the following, but it didn't seem to work, either:

<%
Minutes50FreeBoys=FPFieldVal(fp_rs,"Minutes_Freestyle50yd")
Seconds50FreeBoys=FP_FieldVal(fp_rs,"Seconds_Freestyle50yd")
Hundredths50FreeBoys=FP_FieldVal(fp_rs,"Hundredths_Freestyle50yd")
%>
<%
=Minutes50FreeBoys & ":" & CDouble(Seconds50FreeBoys) & "." &
CDouble(Hundredths50FreeBoys)
%>
 
M

montiy

I figured it out! Just wanted to post it here in case it's a help to anyone
else, at some point. (Turns out that my initial mistake was leaving out a
"&" in the concatenation when displaying the results.)

-- Nate
-------------------------

<%
Minutes50FreeBoys=FP_FieldVal(fp_rs,"Minutes_Freestyle50yd")

Seconds50FreeBoys=FP_FieldVal(fp_rs,"Seconds_Freestyle50yd")

Hundredths50FreeBoys=FP_FieldVal(fp_rs,"Hundredths_Freestyle50yd")

If Seconds50FreeBoys < 10 Then Seconds50FreeBoys = "0" + Seconds50FreeBoys

If Hundredths50FreeBoys < 10 Then Hundredths50FreeBoys = "0" +
Hundredths50FreeBoys
%>

<%
=Minutes50FreeBoys & ":" & Seconds50FreeBoys & "." & Hundredths50FreeBoys
%>
 
D

David Berry

Nate, to help save our sanity here, could you only post your questions in 1
thread?? You posted this 3 different times in 3 different threads. When
you do that it makes it hard for us to help you because we don't know what
someone else may have already suggested in a reply in a different thread or
we may not know that you solved it.

Posting the same thing multiple times won't get a faster response. In fact,
some people won't respond at all if they see it. If someone knows the
answer we'll get to it :)

Thanks
 
M

montiy

No problem. Sorry about that...I just figured it might help to start a new
thread with it, as well. Won't do that anymore...Thanks for all your help!

-- Nate
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top