PC Review
Forums
Newsgroups
Microsoft Word
Microsoft Frontpage
Help with this calculation!!!
Forums
Newsgroups
Microsoft Word
Microsoft Frontpage
Help with this calculation!!!
![]() |
Help with this calculation!!! |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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> |
|
|
|
#2 |
|
Guest
Posts: n/a
|
In looking at the site it looks like you're not formatting the result as a
percent. Ex: Format(myVariable,'##0.00##%') as newVariable "montiy" <montiy@discussions.microsoft.com> wrote in message news:8E4A76D7-E68C-4D2E-B019-1F628C29B4EF@microsoft.com... > 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> > > > > > > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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 > > > "montiy" <montiy@discussions.microsoft.com> wrote in message > news:8E4A76D7-E68C-4D2E-B019-1F628C29B4EF@microsoft.com... > > 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> > > > > > > > > > > > > > > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
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" <montiy@discussions.microsoft.com> wrote in message news C6A7A71-C2FF-44A0-BF86-54FF32133FEC@microsoft.com...>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 >> >> >> "montiy" <montiy@discussions.microsoft.com> wrote in message >> news:8E4A76D7-E68C-4D2E-B019-1F628C29B4EF@microsoft.com... >> > 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> >> > >> > >> > >> > >> > >> > >> >> >> |
|
|
|
#5 |
|
Guest
Posts: n/a
|
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/FrontP...53/Default.aspx _____________________________________________ "montiy" <montiy@discussions.microsoft.com> wrote in message news C6A7A71-C2FF-44A0-BF86-54FF32133FEC@microsoft.com...|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 | > | > | > "montiy" <montiy@discussions.microsoft.com> wrote in message | > news:8E4A76D7-E68C-4D2E-B019-1F628C29B4EF@microsoft.com... | > > 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> | > > | > > | > > | > > | > > | > > | > | > | > |
|
|
|
#6 |
|
Guest
Posts: n/a
|
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." wrote: > 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" <montiy@discussions.microsoft.com> wrote in message > news C6A7A71-C2FF-44A0-BF86-54FF32133FEC@microsoft.com...> >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 > >> > >> > >> "montiy" <montiy@discussions.microsoft.com> wrote in message > >> news:8E4A76D7-E68C-4D2E-B019-1F628C29B4EF@microsoft.com... > >> > 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> > >> > > >> > > >> > > >> > > >> > > >> > > >> > >> > >> > > |
|
|
|
#7 |
|
Guest
Posts: n/a
|
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/ montiy wrote: > 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." wrote: > >> The calculation works fine >> >> I put this into an .asp page >> <%< |

Main Page 

C6A7A71-C2FF-44A0-BF86-54FF32133FEC@microsoft.com...