473,503 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

an ASP automation question

Hello

I am creating a reporting system using SQL Server 2000 and ASP, I have
created 4 pages that display the results i want, however the reports take an
average of 20 mins to run and i have been asked to automate them, i decided
to create another ASP page that uses the filesystemobject to create a static
htm file from the main page.

I decided to put all the declarations and includes my main page creation
page, and stripped these from the asp file so i was left with just the body
of the page, i read the body of the page into a variable and tried to do a
replace on the <%= and the %>

htmFile = replace(htmFile, "<%=", " chr(34) &")
htmFile = replace(htmFile, "%>", " & chr(34)")

I also tried doubling the quotes instead of using chr(34) but with either of
them i get unterminated string constant. I want to be able to just read in
the body of the page replacing any <%=%> so that it scales better. I have 4
reports at the moment but this will grow to any number that the business
wants.

As you can see from my code below a solution i have found is to copy the
body text into a variable and escape the string for the insertion of
variables, but as more and more reports get added the messier its going to
get

hopefully i made sense so if anyone knows how to replace the asp tags or a
way of achieving what i want to do i would appreciate the help

almost forgot the reason i am wanting to replace the asp tags is because
when it creates the page it doesn't show any values

my code is as follows

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% option explicit %>

<%
response.expires = "-1000"

'this declaration belongs to the callcentre report
dim dyTotalAppsWrit, dyTotalValueOfApps, dyTotalSourced, dyTotalSumSourced,
dySrceVol, dySrceVal
dim wkTotalAppsWrit, wkTotalValueOfApps, wkTotalSourced, wkTotalSumSourced,
wkSrceVol, wkSrceVal
dim mnTotalAppsWrit, mnTotalValueOfApps, mnTotalSourced, mnTotalSumSourced,
mnSrceVol, mnSrceVal
dim qtTotalAppsWrit, qtTotalValueOfApps, qtTotalSourced, qtTotalSumSourced,
qtSrceVol, qtSrceVal
dim yrTotalAppsWrit, yrTotalValueOfApps, yrTotalSourced, yrTotalSumSourced,
yrSrceVol, yrSrceVal

'this declaration belongs to the LCT BAG Report
dim dyTotalBooked, dyBookingValue, dyBookingFees, dyVisitsVolume,
dyVisitsValue, dyVisitsFees, dySignVolume, dySignValue, dySignFees
dim wkTotalBooked, wkBookingValue, wkBookingFees, wkVisitsVolume,
wkVisitsValue, wkVisitsFees, wkSignVolume, wkSignValue, wkSignFees
dim mnTotalBooked, mnBookingValue, mnBookingFees, mnVisitsVolume,
mnVisitsValue, mnVisitsFees, mnSignVolume, mnSignValue, mnSignFees
dim qtTotalBooked, qtBookingValue, qtBookingFees, qtVisitsVolume,
qtVisitsValue, qtVisitsFees, qtSignVolume, qtSignValue, qtSignFees
dim yrTotalBooked, yrBookingValue, yrBookingFees, yrVisitsVolume,
yrVisitsValue, yrVisitsFees, yrSignVolume, yrSignValue, yrSignFees

'these are needed for the page to function
dim PageTop, CCBagPage, LCTBagPage
%>
<!--#include file="scripts\DBDataScript.asp"-->
<!--#include file="DBArea\loc\location.inc"-->
<!--#include file="include\connection.inc"-->
<%
SetUpPages "Call Centre - BAG Report"
GettheValuesCCBag

CCBagPage = "<table width='950' border='1' cellspacing='0' cellpadding='0'
align='center' style='border-collapse:collapse;'><tr> <td><span
class='style12'>Call Centre </span></td> <td><span
class='style12'>Applications Written Volumes </span></td> <td><span
class='style12'>Applications Written Value </span></td> <td><span
class='style12'>Applications Sourced Volume </span></td> <td><span
class='style13'>%</span></td> <td><span class='style12'>Applications
Sourced Value </span></td> <td><span class='style13'>%</span></td></tr><tr>
<td><span class='style12'>Daily</span></td> <td><span class='style13'>" &
dyTotalAppsWrit & "</span></td><td><span class='style13'>" &
formatcurrency(dyTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & dyTotalSourced & "</span></td> <td width='30px'>" &
dySrceVol & "</td> <td><span class='style13'>" &
formatcurrency(dyTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & dySrceVal & "</span></td></tr><tr> <td><span
class='style12'>Week To Date </span></td> <td><span class='style13'>" &
wkTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(wkTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & wkTotalSourced & "</span></td> <td width='30px'>" &
wkSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(wkTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & wkSrceVal & "</span></td></tr><tr> <td><span
class='style12'>Month To Date </span></td> <td><span class='style13'>" &
mnTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(mnTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & mnTotalSourced & "</span></td> <td width='30px'>" &
mnSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(mnTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & mnSrceVal & "</span></td></tr><tr> <td><span
class='style12'>Quarter To Date </span></td> <td><span class='style13'>" &
qtTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(qtTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & qtTotalSourced & "</span></td> <td width='30px'>" &
qtSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(qtTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & qtSrceVal & "</span></td></tr><tr> <td><span
class='style12'>Year To Date </span></td> <td><span class='style13'>" &
yrTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(yrTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & yrTotalSourced & "</span></td> <td width='30px'>" &
yrSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(yrTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & yrSrceVal & "</span></td></tr></table><br /><table
width='950' border='1' cellspacing='0' cellpadding='0' align='center'
style='border-collapse:collapse;'><tr> <td width='166'><span
class='style12'>Call Centre </span></td> <td width='166'><span
class='style12'>Dead - Agent Error Volume </span></td> <td
width='30'>%</td> <td width='166'><span class='style12'>Dead - Agent Error
Value </span></td> <td width='30'><span class='style13'>%</span></td> <td
width='166'><span class='style12'>Dead - Out of Criteria Volume</span></td>
<td width='30'>%</td> <td width='166'>Dead- Out of Criteria Value </td>
<td width='30'>%</td></tr><tr> <td><span class='style12'>Daily</span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td> <td
width='40'>&nbsp;</td> <td><span class='style13'></span></td> <td
width='24'>&nbsp;</td> <td width='159'>&nbsp;</td> <td width='43'><span
class='style13'></span></td></tr><tr> <td><span class='style12'>Week To
Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><span
class='style13'></span></td></tr><tr> <td><span class='style12'>Month To
Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><span
class='style13'></span></td></tr><tr> <td><span class='style12'>Quarter To
Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><span
class='style13'></span></td></tr><tr> <td><span class='style12'>Year To
Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><span
class='style13'></span></td></tr></table></body></html>"


If makeHtmFile(CCBagPage) Then
response.write "File created Successfully"
Else
response.write "File creation failed : " & err.description
end if
%>

<%
Sub SetUpPages(pageTitle)
PageTop = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html
xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv='Content-Type'
content='text/html; charset=iso-8859-1' />" & _
"<title>" & pageTitle & "</title><link href='styles/style.css'
rel='stylesheet' type='text/css' /></head><body><table width='950'
border='1' cellspacing='0' cellpadding='0' align='center'
style='border-collapse:collapse;'><tr><td colspan='3'><img
src='images/logo.png' /></td></tr> <tr><td colspan='3'><div
align='center'><img src='images/menubar.png' alt='earth logo' width='830'
height='30' /></div></td> </tr> <tr><td colspan='3'>&nbsp;</td></tr>
<tr> <td><span class='style1'>Earth Mortgages - Business at a glance -
report</span></td> <td>Date</td> <td>&nbsp;" &
formatdatetime(now(), vblongdate) & "</td> </tr> <tr><td
colspan='3'>&nbsp;</td></tr></table><br />"
End Sub
%>

<%
Function makeHTMFile(pageBody)

dim htmFile, fso, ts, htmFileName

'set the filename of the htmfile in the format yyyy-mm-dd-ReportTitle
htmFileName = server.MapPath(".") & "\automation\" & year(date) & "-" &
month(date) & "-" & day(date) & "-CallCentreBAG.htm"

set fso = Server.CreateObject("Scripting.FileSystemObject") 'instantiate the
object
'Set ts = fso.OpenTextFile(server.MapPath(".") & "\indextest.asp", 1)
htmFile = pageTop & pageBody 'ts.readall

response.write htmFile 'for debugging purposes

Set ts = fso.CreateTextFile(htmFileName, True) 'create a textfile using the
fso object

ts.write htmFile
ts.close

set fso = nothing

If err.number = 0 Then
makeHTMFile = True
Else
makeHTMFile = False
End If

End Function

%>
Jan 4 '06 #1
8 1745
After messing with it for a while i have found out that it is replacing the
<%= and the " that is now there is causing the problem when i try and
replace the %>

I have tried replace(replace(htmFile, "<%=", chr(34) & " & "), "%>", " & " &
chr(34)) but this throws up the same error

htmFile = replace(replace(htmFile, "<%=", chr(34) & " & "), "
-------------------------------------------------------------^any ideas ?
"Steven Scaife" <sp@nospam.com> wrote in message
news:uX**************@TK2MSFTNGP12.phx.gbl...
Hello

I am creating a reporting system using SQL Server 2000 and ASP, I have
created 4 pages that display the results i want, however the reports take
an average of 20 mins to run and i have been asked to automate them, i
decided to create another ASP page that uses the filesystemobject to
create a static htm file from the main page.

I decided to put all the declarations and includes my main page creation
page, and stripped these from the asp file so i was left with just the
body of the page, i read the body of the page into a variable and tried to
do a replace on the <%= and the %>

htmFile = replace(htmFile, "<%=", " chr(34) &")
htmFile = replace(htmFile, "%>", " & chr(34)")

I also tried doubling the quotes instead of using chr(34) but with either
of them i get unterminated string constant. I want to be able to just
read in the body of the page replacing any <%=%> so that it scales better.
I have 4 reports at the moment but this will grow to any number that the
business wants.

As you can see from my code below a solution i have found is to copy the
body text into a variable and escape the string for the insertion of
variables, but as more and more reports get added the messier its going to
get

hopefully i made sense so if anyone knows how to replace the asp tags or a
way of achieving what i want to do i would appreciate the help

almost forgot the reason i am wanting to replace the asp tags is because
when it creates the page it doesn't show any values

my code is as follows

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% option explicit %>

<%
response.expires = "-1000"

'this declaration belongs to the callcentre report
dim dyTotalAppsWrit, dyTotalValueOfApps, dyTotalSourced,
dyTotalSumSourced, dySrceVol, dySrceVal
dim wkTotalAppsWrit, wkTotalValueOfApps, wkTotalSourced,
wkTotalSumSourced, wkSrceVol, wkSrceVal
dim mnTotalAppsWrit, mnTotalValueOfApps, mnTotalSourced,
mnTotalSumSourced, mnSrceVol, mnSrceVal
dim qtTotalAppsWrit, qtTotalValueOfApps, qtTotalSourced,
qtTotalSumSourced, qtSrceVol, qtSrceVal
dim yrTotalAppsWrit, yrTotalValueOfApps, yrTotalSourced,
yrTotalSumSourced, yrSrceVol, yrSrceVal

'this declaration belongs to the LCT BAG Report
dim dyTotalBooked, dyBookingValue, dyBookingFees, dyVisitsVolume,
dyVisitsValue, dyVisitsFees, dySignVolume, dySignValue, dySignFees
dim wkTotalBooked, wkBookingValue, wkBookingFees, wkVisitsVolume,
wkVisitsValue, wkVisitsFees, wkSignVolume, wkSignValue, wkSignFees
dim mnTotalBooked, mnBookingValue, mnBookingFees, mnVisitsVolume,
mnVisitsValue, mnVisitsFees, mnSignVolume, mnSignValue, mnSignFees
dim qtTotalBooked, qtBookingValue, qtBookingFees, qtVisitsVolume,
qtVisitsValue, qtVisitsFees, qtSignVolume, qtSignValue, qtSignFees
dim yrTotalBooked, yrBookingValue, yrBookingFees, yrVisitsVolume,
yrVisitsValue, yrVisitsFees, yrSignVolume, yrSignValue, yrSignFees

'these are needed for the page to function
dim PageTop, CCBagPage, LCTBagPage
%>
<!--#include file="scripts\DBDataScript.asp"-->
<!--#include file="DBArea\loc\location.inc"-->
<!--#include file="include\connection.inc"-->
<%
SetUpPages "Call Centre - BAG Report"
GettheValuesCCBag

CCBagPage = "<table width='950' border='1' cellspacing='0' cellpadding='0'
align='center' style='border-collapse:collapse;'><tr> <td><span
class='style12'>Call Centre </span></td> <td><span
class='style12'>Applications Written Volumes </span></td> <td><span
class='style12'>Applications Written Value </span></td> <td><span
class='style12'>Applications Sourced Volume </span></td> <td><span
class='style13'>%</span></td> <td><span class='style12'>Applications
Sourced Value </span></td> <td><span
class='style13'>%</span></td></tr><tr> <td><span
class='style12'>Daily</span></td> <td><span class='style13'>" &
dyTotalAppsWrit & "</span></td><td><span class='style13'>" &
formatcurrency(dyTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & dyTotalSourced & "</span></td> <td width='30px'>" &
dySrceVol & "</td> <td><span class='style13'>" &
formatcurrency(dyTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & dySrceVal & "</span></td></tr><tr> <td><span
class='style12'>Week To Date </span></td> <td><span class='style13'>" &
wkTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(wkTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & wkTotalSourced & "</span></td> <td width='30px'>" &
wkSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(wkTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & wkSrceVal & "</span></td></tr><tr> <td><span
class='style12'>Month To Date </span></td> <td><span class='style13'>" &
mnTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(mnTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & mnTotalSourced & "</span></td> <td width='30px'>" &
mnSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(mnTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & mnSrceVal & "</span></td></tr><tr> <td><span
class='style12'>Quarter To Date </span></td> <td><span class='style13'>"
& qtTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(qtTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & qtTotalSourced & "</span></td> <td width='30px'>" &
qtSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(qtTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & qtSrceVal & "</span></td></tr><tr> <td><span
class='style12'>Year To Date </span></td> <td><span class='style13'>" &
yrTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(yrTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & yrTotalSourced & "</span></td> <td width='30px'>" &
yrSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(yrTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & yrSrceVal & "</span></td></tr></table><br /><table
width='950' border='1' cellspacing='0' cellpadding='0' align='center'
style='border-collapse:collapse;'><tr> <td width='166'><span
class='style12'>Call Centre </span></td> <td width='166'><span
class='style12'>Dead - Agent Error Volume </span></td> <td
width='30'>%</td> <td width='166'><span class='style12'>Dead - Agent
Error Value </span></td> <td width='30'><span
class='style13'>%</span></td> <td width='166'><span
class='style12'>Dead - Out of Criteria Volume</span></td> <td
width='30'>%</td> <td width='166'>Dead- Out of Criteria Value </td> <td
width='30'>%</td></tr><tr> <td><span class='style12'>Daily</span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td> <td
width='40'>&nbsp;</td> <td><span class='style13'></span></td> <td
width='24'>&nbsp;</td> <td width='159'>&nbsp;</td> <td width='43'><span
class='style13'></span></td></tr><tr> <td><span class='style12'>Week To
Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><span
class='style13'></span></td></tr><tr> <td><span class='style12'>Month To
Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><span
class='style13'></span></td></tr><tr> <td><span class='style12'>Quarter
To Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><span
class='style13'></span></td></tr><tr> <td><span class='style12'>Year To
Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><span
class='style13'></span></td></tr></table></body></html>"


If makeHtmFile(CCBagPage) Then
response.write "File created Successfully"
Else
response.write "File creation failed : " & err.description
end if
%>

<%
Sub SetUpPages(pageTitle)
PageTop = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html
xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv='Content-Type'
content='text/html; charset=iso-8859-1' />" & _
"<title>" & pageTitle & "</title><link href='styles/style.css'
rel='stylesheet' type='text/css' /></head><body><table width='950'
border='1' cellspacing='0' cellpadding='0' align='center'
style='border-collapse:collapse;'><tr><td colspan='3'><img
src='images/logo.png' /></td></tr> <tr><td colspan='3'><div
align='center'><img src='images/menubar.png' alt='earth logo' width='830'
height='30' /></div></td> </tr> <tr><td colspan='3'>&nbsp;</td></tr>
<tr> <td><span class='style1'>Earth Mortgages - Business at a
glance - report</span></td> <td>Date</td> <td>&nbsp;" &
formatdatetime(now(), vblongdate) & "</td> </tr> <tr><td
colspan='3'>&nbsp;</td></tr></table><br />"
End Sub
%>

<%
Function makeHTMFile(pageBody)

dim htmFile, fso, ts, htmFileName

'set the filename of the htmfile in the format yyyy-mm-dd-ReportTitle
htmFileName = server.MapPath(".") & "\automation\" & year(date) & "-" &
month(date) & "-" & day(date) & "-CallCentreBAG.htm"

set fso = Server.CreateObject("Scripting.FileSystemObject") 'instantiate
the object
'Set ts = fso.OpenTextFile(server.MapPath(".") & "\indextest.asp", 1)
htmFile = pageTop & pageBody 'ts.readall

response.write htmFile 'for debugging purposes

Set ts = fso.CreateTextFile(htmFileName, True) 'create a textfile using
the fso object

ts.write htmFile
ts.close

set fso = nothing

If err.number = 0 Then
makeHTMFile = True
Else
makeHTMFile = False
End If

End Function

%>

Jan 4 '06 #2
I'm not sure what you are trying to do...

Possible solution I see are :
- use MyFile.Write instead of Response.Write so that the output goes to a
file
- use ServerXMLHttp to request this page so that you can get and grab this
HTML code

You may want also to invest some time into seeing why it is so long. In
particular note that if most of the time is spent in downloading a 100 Mb
report file, it won't change much when you'll try to download a 100 Mb
static file...

Good luck.

--
Patrice

"Steven Scaife" <sp@nospam.com> a écrit dans le message de
news:uX**************@TK2MSFTNGP12.phx.gbl...
Hello

I am creating a reporting system using SQL Server 2000 and ASP, I have
created 4 pages that display the results i want, however the reports take an average of 20 mins to run and i have been asked to automate them, i decided to create another ASP page that uses the filesystemobject to create a static htm file from the main page.

I decided to put all the declarations and includes my main page creation
page, and stripped these from the asp file so i was left with just the body of the page, i read the body of the page into a variable and tried to do a
replace on the <%= and the %>

htmFile = replace(htmFile, "<%=", " chr(34) &")
htmFile = replace(htmFile, "%>", " & chr(34)")

I also tried doubling the quotes instead of using chr(34) but with either of them i get unterminated string constant. I want to be able to just read in the body of the page replacing any <%=%> so that it scales better. I have 4 reports at the moment but this will grow to any number that the business
wants.

As you can see from my code below a solution i have found is to copy the
body text into a variable and escape the string for the insertion of
variables, but as more and more reports get added the messier its going to
get

hopefully i made sense so if anyone knows how to replace the asp tags or a
way of achieving what i want to do i would appreciate the help

almost forgot the reason i am wanting to replace the asp tags is because
when it creates the page it doesn't show any values

my code is as follows

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% option explicit %>

<%
response.expires = "-1000"

'this declaration belongs to the callcentre report
dim dyTotalAppsWrit, dyTotalValueOfApps, dyTotalSourced, dyTotalSumSourced, dySrceVol, dySrceVal
dim wkTotalAppsWrit, wkTotalValueOfApps, wkTotalSourced, wkTotalSumSourced, wkSrceVol, wkSrceVal
dim mnTotalAppsWrit, mnTotalValueOfApps, mnTotalSourced, mnTotalSumSourced, mnSrceVol, mnSrceVal
dim qtTotalAppsWrit, qtTotalValueOfApps, qtTotalSourced, qtTotalSumSourced, qtSrceVol, qtSrceVal
dim yrTotalAppsWrit, yrTotalValueOfApps, yrTotalSourced, yrTotalSumSourced, yrSrceVol, yrSrceVal

'this declaration belongs to the LCT BAG Report
dim dyTotalBooked, dyBookingValue, dyBookingFees, dyVisitsVolume,
dyVisitsValue, dyVisitsFees, dySignVolume, dySignValue, dySignFees
dim wkTotalBooked, wkBookingValue, wkBookingFees, wkVisitsVolume,
wkVisitsValue, wkVisitsFees, wkSignVolume, wkSignValue, wkSignFees
dim mnTotalBooked, mnBookingValue, mnBookingFees, mnVisitsVolume,
mnVisitsValue, mnVisitsFees, mnSignVolume, mnSignValue, mnSignFees
dim qtTotalBooked, qtBookingValue, qtBookingFees, qtVisitsVolume,
qtVisitsValue, qtVisitsFees, qtSignVolume, qtSignValue, qtSignFees
dim yrTotalBooked, yrBookingValue, yrBookingFees, yrVisitsVolume,
yrVisitsValue, yrVisitsFees, yrSignVolume, yrSignValue, yrSignFees

'these are needed for the page to function
dim PageTop, CCBagPage, LCTBagPage
%>
<!--#include file="scripts\DBDataScript.asp"-->
<!--#include file="DBArea\loc\location.inc"-->
<!--#include file="include\connection.inc"-->
<%
SetUpPages "Call Centre - BAG Report"
GettheValuesCCBag

CCBagPage = "<table width='950' border='1' cellspacing='0' cellpadding='0'
align='center' style='border-collapse:collapse;'><tr> <td><span
class='style12'>Call Centre </span></td> <td><span
class='style12'>Applications Written Volumes </span></td> <td><span
class='style12'>Applications Written Value </span></td> <td><span
class='style12'>Applications Sourced Volume </span></td> <td><span
class='style13'>%</span></td> <td><span class='style12'>Applications
Sourced Value </span></td> <td><span class='style13'>%</span></td></tr><tr> <td><span class='style12'>Daily</span></td> <td><span class='style13'>" &
dyTotalAppsWrit & "</span></td><td><span class='style13'>" &
formatcurrency(dyTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & dyTotalSourced & "</span></td> <td width='30px'>" &
dySrceVol & "</td> <td><span class='style13'>" &
formatcurrency(dyTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & dySrceVal & "</span></td></tr><tr> <td><span
class='style12'>Week To Date </span></td> <td><span class='style13'>" &
wkTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(wkTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & wkTotalSourced & "</span></td> <td width='30px'>" &
wkSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(wkTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & wkSrceVal & "</span></td></tr><tr> <td><span
class='style12'>Month To Date </span></td> <td><span class='style13'>" &
mnTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(mnTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & mnTotalSourced & "</span></td> <td width='30px'>" &
mnSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(mnTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & mnSrceVal & "</span></td></tr><tr> <td><span
class='style12'>Quarter To Date </span></td> <td><span class='style13'>" & qtTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(qtTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & qtTotalSourced & "</span></td> <td width='30px'>" &
qtSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(qtTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & qtSrceVal & "</span></td></tr><tr> <td><span
class='style12'>Year To Date </span></td> <td><span class='style13'>" &
yrTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(yrTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & yrTotalSourced & "</span></td> <td width='30px'>" &
yrSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(yrTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & yrSrceVal & "</span></td></tr></table><br /><table
width='950' border='1' cellspacing='0' cellpadding='0' align='center'
style='border-collapse:collapse;'><tr> <td width='166'><span
class='style12'>Call Centre </span></td> <td width='166'><span
class='style12'>Dead - Agent Error Volume </span></td> <td
width='30'>%</td> <td width='166'><span class='style12'>Dead - Agent Error Value </span></td> <td width='30'><span class='style13'>%</span></td> <td width='166'><span class='style12'>Dead - Out of Criteria Volume</span></td> <td width='30'>%</td> <td width='166'>Dead- Out of Criteria Value </td>
<td width='30'>%</td></tr><tr> <td><span class='style12'>Daily</span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td> <td
width='40'>&nbsp;</td> <td><span class='style13'></span></td> <td
width='24'>&nbsp;</td> <td width='159'>&nbsp;</td> <td width='43'><span
class='style13'></span></td></tr><tr> <td><span class='style12'>Week To
Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><span
class='style13'></span></td></tr><tr> <td><span class='style12'>Month To
Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><span
class='style13'></span></td></tr><tr> <td><span class='style12'>Quarter To Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><span
class='style13'></span></td></tr><tr> <td><span class='style12'>Year To
Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><span
class='style13'></span></td></tr></table></body></html>"


If makeHtmFile(CCBagPage) Then
response.write "File created Successfully"
Else
response.write "File creation failed : " & err.description
end if
%>

<%
Sub SetUpPages(pageTitle)
PageTop = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html
xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv='Content-Type'
content='text/html; charset=iso-8859-1' />" & _
"<title>" & pageTitle & "</title><link href='styles/style.css'
rel='stylesheet' type='text/css' /></head><body><table width='950'
border='1' cellspacing='0' cellpadding='0' align='center'
style='border-collapse:collapse;'><tr><td colspan='3'><img
src='images/logo.png' /></td></tr> <tr><td colspan='3'><div
align='center'><img src='images/menubar.png' alt='earth logo' width='830'
height='30' /></div></td> </tr> <tr><td colspan='3'>&nbsp;</td></tr>
<tr> <td><span class='style1'>Earth Mortgages - Business at a glance - report</span></td> <td>Date</td> <td>&nbsp;" &
formatdatetime(now(), vblongdate) & "</td> </tr> <tr><td
colspan='3'>&nbsp;</td></tr></table><br />"
End Sub
%>

<%
Function makeHTMFile(pageBody)

dim htmFile, fso, ts, htmFileName

'set the filename of the htmfile in the format yyyy-mm-dd-ReportTitle
htmFileName = server.MapPath(".") & "\automation\" & year(date) & "-" &
month(date) & "-" & day(date) & "-CallCentreBAG.htm"

set fso = Server.CreateObject("Scripting.FileSystemObject") 'instantiate the object
'Set ts = fso.OpenTextFile(server.MapPath(".") & "\indextest.asp", 1)
htmFile = pageTop & pageBody 'ts.readall

response.write htmFile 'for debugging purposes

Set ts = fso.CreateTextFile(htmFileName, True) 'create a textfile using the fso object

ts.write htmFile
ts.close

set fso = nothing

If err.number = 0 Then
makeHTMFile = True
Else
makeHTMFile = False
End If

End Function

%>

Jan 4 '06 #3
I have built a few pages that show an overall picture of how a department is
performing, currently there are 4 of these for the 4 different areas of the
business.

In a few weeks the business will ask for more detailed reports of these
departments and in 6 months time i expect to have built around 30 or so
reports. By the end of january i have to automate the reports so when the
directors enter the business in a morning they have a static html page to
view of the reports accurate to the day before. I have all the queries in
place and the pages function, however they dont want to wait 20 or so mins
for the reports to run. (the reports show daily, weekly, monthly, quarterly
and yearly all in the same report) So i decided to create a page that using
a loop or something creates the static page with the data within them. I
can create the htm page no problem it has a page title the only thing
missing is the information. Because i have built the pages i dont want to
go through and manually replace all the <%= and %> tags with " & and & ".
It is likely that i will build every page first to test that it works all i
want to do then is pass it through to the page that will build a static htm
file.

Hope this makes sense so far.

I have no problem reading the asp file using the fso object into a variable,
everything seems to be in order except for the fact that my asp page is
littered with <%= %> anything inside of these tags doesnt display so i need
to replace them that way my page variable will have the body text of the
page and the values from my recordset.

I can go through and do a find and replace on all the tags but i would
prefer to not do that and have the system totally free from that. I create
the page and then drop it into the directory that holds them all, and using
a loop i pass every page into the function that creates a static copy of
them.

Hope this makes sense, if what i want cant be done then i'll have to
manually find and replace

cheers

"Patrice" <no****@nowhere.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
I'm not sure what you are trying to do...

Possible solution I see are :
- use MyFile.Write instead of Response.Write so that the output goes to a
file
- use ServerXMLHttp to request this page so that you can get and grab this
HTML code

You may want also to invest some time into seeing why it is so long. In
particular note that if most of the time is spent in downloading a 100 Mb
report file, it won't change much when you'll try to download a 100 Mb
static file...

Good luck.

--
Patrice

"Steven Scaife" <sp@nospam.com> a écrit dans le message de
news:uX**************@TK2MSFTNGP12.phx.gbl...
Hello

I am creating a reporting system using SQL Server 2000 and ASP, I have
created 4 pages that display the results i want, however the reports take

an
average of 20 mins to run and i have been asked to automate them, i

decided
to create another ASP page that uses the filesystemobject to create a

static
htm file from the main page.

I decided to put all the declarations and includes my main page creation
page, and stripped these from the asp file so i was left with just the

body
of the page, i read the body of the page into a variable and tried to do
a
replace on the <%= and the %>

htmFile = replace(htmFile, "<%=", " chr(34) &")
htmFile = replace(htmFile, "%>", " & chr(34)")

I also tried doubling the quotes instead of using chr(34) but with either

of
them i get unterminated string constant. I want to be able to just read

in
the body of the page replacing any <%=%> so that it scales better. I have

4
reports at the moment but this will grow to any number that the business
wants.

As you can see from my code below a solution i have found is to copy the
body text into a variable and escape the string for the insertion of
variables, but as more and more reports get added the messier its going
to
get

hopefully i made sense so if anyone knows how to replace the asp tags or
a
way of achieving what i want to do i would appreciate the help

almost forgot the reason i am wanting to replace the asp tags is because
when it creates the page it doesn't show any values

my code is as follows

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% option explicit %>

<%
response.expires = "-1000"

'this declaration belongs to the callcentre report
dim dyTotalAppsWrit, dyTotalValueOfApps, dyTotalSourced,

dyTotalSumSourced,
dySrceVol, dySrceVal
dim wkTotalAppsWrit, wkTotalValueOfApps, wkTotalSourced,

wkTotalSumSourced,
wkSrceVol, wkSrceVal
dim mnTotalAppsWrit, mnTotalValueOfApps, mnTotalSourced,

mnTotalSumSourced,
mnSrceVol, mnSrceVal
dim qtTotalAppsWrit, qtTotalValueOfApps, qtTotalSourced,

qtTotalSumSourced,
qtSrceVol, qtSrceVal
dim yrTotalAppsWrit, yrTotalValueOfApps, yrTotalSourced,

yrTotalSumSourced,
yrSrceVol, yrSrceVal

'this declaration belongs to the LCT BAG Report
dim dyTotalBooked, dyBookingValue, dyBookingFees, dyVisitsVolume,
dyVisitsValue, dyVisitsFees, dySignVolume, dySignValue, dySignFees
dim wkTotalBooked, wkBookingValue, wkBookingFees, wkVisitsVolume,
wkVisitsValue, wkVisitsFees, wkSignVolume, wkSignValue, wkSignFees
dim mnTotalBooked, mnBookingValue, mnBookingFees, mnVisitsVolume,
mnVisitsValue, mnVisitsFees, mnSignVolume, mnSignValue, mnSignFees
dim qtTotalBooked, qtBookingValue, qtBookingFees, qtVisitsVolume,
qtVisitsValue, qtVisitsFees, qtSignVolume, qtSignValue, qtSignFees
dim yrTotalBooked, yrBookingValue, yrBookingFees, yrVisitsVolume,
yrVisitsValue, yrVisitsFees, yrSignVolume, yrSignValue, yrSignFees

'these are needed for the page to function
dim PageTop, CCBagPage, LCTBagPage
%>
<!--#include file="scripts\DBDataScript.asp"-->
<!--#include file="DBArea\loc\location.inc"-->
<!--#include file="include\connection.inc"-->
<%
SetUpPages "Call Centre - BAG Report"
GettheValuesCCBag

CCBagPage = "<table width='950' border='1' cellspacing='0'
cellpadding='0'
align='center' style='border-collapse:collapse;'><tr> <td><span
class='style12'>Call Centre </span></td> <td><span
class='style12'>Applications Written Volumes </span></td> <td><span
class='style12'>Applications Written Value </span></td> <td><span
class='style12'>Applications Sourced Volume </span></td> <td><span
class='style13'>%</span></td> <td><span class='style12'>Applications
Sourced Value </span></td> <td><span

class='style13'>%</span></td></tr><tr>
<td><span class='style12'>Daily</span></td> <td><span class='style13'>"
&
dyTotalAppsWrit & "</span></td><td><span class='style13'>" &
formatcurrency(dyTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & dyTotalSourced & "</span></td> <td width='30px'>" &
dySrceVol & "</td> <td><span class='style13'>" &
formatcurrency(dyTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & dySrceVal & "</span></td></tr><tr> <td><span
class='style12'>Week To Date </span></td> <td><span class='style13'>" &
wkTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(wkTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & wkTotalSourced & "</span></td> <td width='30px'>" &
wkSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(wkTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & wkSrceVal & "</span></td></tr><tr> <td><span
class='style12'>Month To Date </span></td> <td><span class='style13'>" &
mnTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(mnTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & mnTotalSourced & "</span></td> <td width='30px'>" &
mnSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(mnTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & mnSrceVal & "</span></td></tr><tr> <td><span
class='style12'>Quarter To Date </span></td> <td><span class='style13'>"

&
qtTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(qtTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & qtTotalSourced & "</span></td> <td width='30px'>" &
qtSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(qtTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & qtSrceVal & "</span></td></tr><tr> <td><span
class='style12'>Year To Date </span></td> <td><span class='style13'>" &
yrTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(yrTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & yrTotalSourced & "</span></td> <td width='30px'>" &
yrSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(yrTotalSumSourced) & "</span></td> <td width='30px'><span
class='style13'>" & yrSrceVal & "</span></td></tr></table><br /><table
width='950' border='1' cellspacing='0' cellpadding='0' align='center'
style='border-collapse:collapse;'><tr> <td width='166'><span
class='style12'>Call Centre </span></td> <td width='166'><span
class='style12'>Dead - Agent Error Volume </span></td> <td
width='30'>%</td> <td width='166'><span class='style12'>Dead - Agent

Error
Value </span></td> <td width='30'><span class='style13'>%</span></td>

<td
width='166'><span class='style12'>Dead - Out of Criteria

Volume</span></td>
<td width='30'>%</td> <td width='166'>Dead- Out of Criteria Value </td>
<td width='30'>%</td></tr><tr> <td><span

class='style12'>Daily</span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td> <td
width='40'>&nbsp;</td> <td><span class='style13'></span></td> <td
width='24'>&nbsp;</td> <td width='159'>&nbsp;</td> <td width='43'><span
class='style13'></span></td></tr><tr> <td><span class='style12'>Week To
Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><span
class='style13'></span></td></tr><tr> <td><span class='style12'>Month To
Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><span
class='style13'></span></td></tr><tr> <td><span class='style12'>Quarter

To
Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><span
class='style13'></span></td></tr><tr> <td><span class='style12'>Year To
Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><span
class='style13'></span></td></tr></table></body></html>"


If makeHtmFile(CCBagPage) Then
response.write "File created Successfully"
Else
response.write "File creation failed : " & err.description
end if
%>

<%
Sub SetUpPages(pageTitle)
PageTop = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html
xmlns='http://www.w3.org/1999/xhtml'><head><meta
http-equiv='Content-Type'
content='text/html; charset=iso-8859-1' />" & _
"<title>" & pageTitle & "</title><link href='styles/style.css'
rel='stylesheet' type='text/css' /></head><body><table width='950'
border='1' cellspacing='0' cellpadding='0' align='center'
style='border-collapse:collapse;'><tr><td colspan='3'><img
src='images/logo.png' /></td></tr> <tr><td colspan='3'><div
align='center'><img src='images/menubar.png' alt='earth logo' width='830'
height='30' /></div></td> </tr> <tr><td colspan='3'>&nbsp;</td></tr>
<tr> <td><span class='style1'>Earth Mortgages - Business at a

glance -
report</span></td> <td>Date</td> <td>&nbsp;" &
formatdatetime(now(), vblongdate) & "</td> </tr> <tr><td
colspan='3'>&nbsp;</td></tr></table><br />"
End Sub
%>

<%
Function makeHTMFile(pageBody)

dim htmFile, fso, ts, htmFileName

'set the filename of the htmfile in the format yyyy-mm-dd-ReportTitle
htmFileName = server.MapPath(".") & "\automation\" & year(date) & "-" &
month(date) & "-" & day(date) & "-CallCentreBAG.htm"

set fso = Server.CreateObject("Scripting.FileSystemObject") 'instantiate

the
object
'Set ts = fso.OpenTextFile(server.MapPath(".") & "\indextest.asp", 1)
htmFile = pageTop & pageBody 'ts.readall

response.write htmFile 'for debugging purposes

Set ts = fso.CreateTextFile(htmFileName, True) 'create a textfile using

the
fso object

ts.write htmFile
ts.close

set fso = nothing

If err.number = 0 Then
makeHTMFile = True
Else
makeHTMFile = False
End If

End Function

%>


Jan 4 '06 #4
Basically it looks like to me you are looking for something like :

htmlFile=Replace("<%=MyNumber%>",MyRealNumber) ? Is this what you mean ?
Bascially you are trying to "run" an ASP page yourself instead of letting
ASP to do the job ?

Depending how your pages are at this time I would really make the plunge to
use a principle such as :

obj.Write

Then at the top if obj is a file, it writes to a file, if it si response, it
writes to the browser allowing quite good flexibility. IMO it would be
quicker on the mean term than trying to let your current pages unchanged (as
you'll keep having all ASP capabilities).

Also I'm quite suspicious about this time. In particular not that if the
report is huge it could be a download file in whihc case you likely won't
gain much from creating the static file.

Sorry for the poor help.

Else shows a small code that shows what you want...

strHtml="<body><%=MyValue%></body>"
strHtml=Replace(strHtml,"<%=MyValue%>",RealValue)
Response.Write strHtml
--

Patrice

"Steven Scaife" <sp@nospam.com> a écrit dans le message de
news:Od**************@TK2MSFTNGP15.phx.gbl...
I have built a few pages that show an overall picture of how a department is performing, currently there are 4 of these for the 4 different areas of the business.

In a few weeks the business will ask for more detailed reports of these
departments and in 6 months time i expect to have built around 30 or so
reports. By the end of january i have to automate the reports so when the
directors enter the business in a morning they have a static html page to
view of the reports accurate to the day before. I have all the queries in
place and the pages function, however they dont want to wait 20 or so mins
for the reports to run. (the reports show daily, weekly, monthly, quarterly and yearly all in the same report) So i decided to create a page that using a loop or something creates the static page with the data within them. I
can create the htm page no problem it has a page title the only thing
missing is the information. Because i have built the pages i dont want to
go through and manually replace all the <%= and %> tags with " & and & ".
It is likely that i will build every page first to test that it works all i want to do then is pass it through to the page that will build a static htm file.

Hope this makes sense so far.

I have no problem reading the asp file using the fso object into a variable, everything seems to be in order except for the fact that my asp page is
littered with <%= %> anything inside of these tags doesnt display so i need to replace them that way my page variable will have the body text of the
page and the values from my recordset.

I can go through and do a find and replace on all the tags but i would
prefer to not do that and have the system totally free from that. I create the page and then drop it into the directory that holds them all, and using a loop i pass every page into the function that creates a static copy of
them.

Hope this makes sense, if what i want cant be done then i'll have to
manually find and replace

cheers

"Patrice" <no****@nowhere.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
I'm not sure what you are trying to do...

Possible solution I see are :
- use MyFile.Write instead of Response.Write so that the output goes to a file
- use ServerXMLHttp to request this page so that you can get and grab this HTML code

You may want also to invest some time into seeing why it is so long. In
particular note that if most of the time is spent in downloading a 100 Mb report file, it won't change much when you'll try to download a 100 Mb
static file...

Good luck.

--
Patrice

"Steven Scaife" <sp@nospam.com> a écrit dans le message de
news:uX**************@TK2MSFTNGP12.phx.gbl...
Hello

I am creating a reporting system using SQL Server 2000 and ASP, I have
created 4 pages that display the results i want, however the reports take
an
average of 20 mins to run and i have been asked to automate them, i

decided
to create another ASP page that uses the filesystemobject to create a

static
htm file from the main page.

I decided to put all the declarations and includes my main page
creation page, and stripped these from the asp file so i was left with just the

body
of the page, i read the body of the page into a variable and tried to do a
replace on the <%= and the %>

htmFile = replace(htmFile, "<%=", " chr(34) &")
htmFile = replace(htmFile, "%>", " & chr(34)")

I also tried doubling the quotes instead of using chr(34) but with either of
them i get unterminated string constant. I want to be able to just
read in
the body of the page replacing any <%=%> so that it scales better. I
have 4
reports at the moment but this will grow to any number that the
business wants.

As you can see from my code below a solution i have found is to copy the body text into a variable and escape the string for the insertion of
variables, but as more and more reports get added the messier its going
to
get

hopefully i made sense so if anyone knows how to replace the asp tags or a
way of achieving what i want to do i would appreciate the help

almost forgot the reason i am wanting to replace the asp tags is because when it creates the page it doesn't show any values

my code is as follows

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% option explicit %>

<%
response.expires = "-1000"

'this declaration belongs to the callcentre report
dim dyTotalAppsWrit, dyTotalValueOfApps, dyTotalSourced,

dyTotalSumSourced,
dySrceVol, dySrceVal
dim wkTotalAppsWrit, wkTotalValueOfApps, wkTotalSourced,

wkTotalSumSourced,
wkSrceVol, wkSrceVal
dim mnTotalAppsWrit, mnTotalValueOfApps, mnTotalSourced,

mnTotalSumSourced,
mnSrceVol, mnSrceVal
dim qtTotalAppsWrit, qtTotalValueOfApps, qtTotalSourced,

qtTotalSumSourced,
qtSrceVol, qtSrceVal
dim yrTotalAppsWrit, yrTotalValueOfApps, yrTotalSourced,

yrTotalSumSourced,
yrSrceVol, yrSrceVal

'this declaration belongs to the LCT BAG Report
dim dyTotalBooked, dyBookingValue, dyBookingFees, dyVisitsVolume,
dyVisitsValue, dyVisitsFees, dySignVolume, dySignValue, dySignFees
dim wkTotalBooked, wkBookingValue, wkBookingFees, wkVisitsVolume,
wkVisitsValue, wkVisitsFees, wkSignVolume, wkSignValue, wkSignFees
dim mnTotalBooked, mnBookingValue, mnBookingFees, mnVisitsVolume,
mnVisitsValue, mnVisitsFees, mnSignVolume, mnSignValue, mnSignFees
dim qtTotalBooked, qtBookingValue, qtBookingFees, qtVisitsVolume,
qtVisitsValue, qtVisitsFees, qtSignVolume, qtSignValue, qtSignFees
dim yrTotalBooked, yrBookingValue, yrBookingFees, yrVisitsVolume,
yrVisitsValue, yrVisitsFees, yrSignVolume, yrSignValue, yrSignFees

'these are needed for the page to function
dim PageTop, CCBagPage, LCTBagPage
%>
<!--#include file="scripts\DBDataScript.asp"-->
<!--#include file="DBArea\loc\location.inc"-->
<!--#include file="include\connection.inc"-->
<%
SetUpPages "Call Centre - BAG Report"
GettheValuesCCBag

CCBagPage = "<table width='950' border='1' cellspacing='0'
cellpadding='0'
align='center' style='border-collapse:collapse;'><tr> <td><span
class='style12'>Call Centre </span></td> <td><span
class='style12'>Applications Written Volumes </span></td> <td><span
class='style12'>Applications Written Value </span></td> <td><span
class='style12'>Applications Sourced Volume </span></td> <td><span
class='style13'>%</span></td> <td><span class='style12'>Applications
Sourced Value </span></td> <td><span

class='style13'>%</span></td></tr><tr>
<td><span class='style12'>Daily</span></td> <td><span class='style13'>" &
dyTotalAppsWrit & "</span></td><td><span class='style13'>" &
formatcurrency(dyTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & dyTotalSourced & "</span></td> <td width='30px'>" & dySrceVol & "</td> <td><span class='style13'>" &
formatcurrency(dyTotalSumSourced) & "</span></td> <td width='30px'><span class='style13'>" & dySrceVal & "</span></td></tr><tr> <td><span
class='style12'>Week To Date </span></td> <td><span class='style13'>" & wkTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(wkTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & wkTotalSourced & "</span></td> <td width='30px'>" & wkSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(wkTotalSumSourced) & "</span></td> <td width='30px'><span class='style13'>" & wkSrceVal & "</span></td></tr><tr> <td><span
class='style12'>Month To Date </span></td> <td><span class='style13'>" & mnTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(mnTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & mnTotalSourced & "</span></td> <td width='30px'>" & mnSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(mnTotalSumSourced) & "</span></td> <td width='30px'><span class='style13'>" & mnSrceVal & "</span></td></tr><tr> <td><span
class='style12'>Quarter To Date </span></td> <td><span class='style13'>" &
qtTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(qtTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & qtTotalSourced & "</span></td> <td width='30px'>"
& qtSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(qtTotalSumSourced) & "</span></td> <td width='30px'><span class='style13'>" & qtSrceVal & "</span></td></tr><tr> <td><span
class='style12'>Year To Date </span></td> <td><span class='style13'>" & yrTotalAppsWrit & "</span></td> <td><span class='style13'>" &
formatcurrency(yrTotalValueOfApps) & "</span></td> <td><span
class='style13'>" & yrTotalSourced & "</span></td> <td width='30px'>" & yrSrceVol & "</td> <td><span class='style13'>" &
formatcurrency(yrTotalSumSourced) & "</span></td> <td width='30px'><span class='style13'>" & yrSrceVal & "</span></td></tr></table><br /><table
width='950' border='1' cellspacing='0' cellpadding='0' align='center'
style='border-collapse:collapse;'><tr> <td width='166'><span
class='style12'>Call Centre </span></td> <td width='166'><span
class='style12'>Dead - Agent Error Volume </span></td> <td
width='30'>%</td> <td width='166'><span class='style12'>Dead - Agent

Error
Value </span></td> <td width='30'><span class='style13'>%</span></td>

<td
width='166'><span class='style12'>Dead - Out of Criteria

Volume</span></td>
<td width='30'>%</td> <td width='166'>Dead- Out of Criteria Value </td> <td width='30'>%</td></tr><tr> <td><span

class='style12'>Daily</span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td> <td width='40'>&nbsp;</td> <td><span class='style13'></span></td> <td
width='24'>&nbsp;</td> <td width='159'>&nbsp;</td> <td width='43'><span class='style13'></span></td></tr><tr> <td><span class='style12'>Week To Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><span class='style13'></span></td></tr><tr> <td><span class='style12'>Month To Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><span class='style13'></span></td></tr><tr> <td><span class='style12'>Quarter To
Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td>
<td><span class='style13'></span></td></tr><tr> <td><span class='style12'>Year To Date </span></td> <td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td><span class='style13'></span></td>
<td><span class='style13'></span></td> <td><span
class='style13'></span></td> <td>&nbsp;</td> <td>&nbsp;</td> <td><span class='style13'></span></td></tr></table></body></html>"


If makeHtmFile(CCBagPage) Then
response.write "File created Successfully"
Else
response.write "File creation failed : " & err.description
end if
%>

<%
Sub SetUpPages(pageTitle)
PageTop = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html
xmlns='http://www.w3.org/1999/xhtml'><head><meta
http-equiv='Content-Type'
content='text/html; charset=iso-8859-1' />" & _
"<title>" & pageTitle & "</title><link href='styles/style.css'
rel='stylesheet' type='text/css' /></head><body><table width='950'
border='1' cellspacing='0' cellpadding='0' align='center'
style='border-collapse:collapse;'><tr><td colspan='3'><img
src='images/logo.png' /></td></tr> <tr><td colspan='3'><div
align='center'><img src='images/menubar.png' alt='earth logo' width='830' height='30' /></div></td> </tr> <tr><td colspan='3'>&nbsp;</td></tr>
<tr> <td><span class='style1'>Earth Mortgages - Business at a

glance -
report</span></td> <td>Date</td> <td>&nbsp;" &
formatdatetime(now(), vblongdate) & "</td> </tr> <tr><td
colspan='3'>&nbsp;</td></tr></table><br />"
End Sub
%>

<%
Function makeHTMFile(pageBody)

dim htmFile, fso, ts, htmFileName

'set the filename of the htmfile in the format yyyy-mm-dd-ReportTitle
htmFileName = server.MapPath(".") & "\automation\" & year(date) & "-" &
month(date) & "-" & day(date) & "-CallCentreBAG.htm"

set fso = Server.CreateObject("Scripting.FileSystemObject")

'instantiate the
object
'Set ts = fso.OpenTextFile(server.MapPath(".") & "\indextest.asp", 1)
htmFile = pageTop & pageBody 'ts.readall

response.write htmFile 'for debugging purposes

Set ts = fso.CreateTextFile(htmFileName, True) 'create a textfile using

the
fso object

ts.write htmFile
ts.close

set fso = nothing

If err.number = 0 Then
makeHTMFile = True
Else
makeHTMFile = False
End If

End Function

%>



Jan 4 '06 #5

Steven Scaife wrote:
Hello

I am creating a reporting system using SQL Server 2000 and ASP, I have
created 4 pages that display the results i want, however the reports take an
average of 20 mins to run and i have been asked to automate them, i decided
to create another ASP page that uses the filesystemobject to create a static
htm file from the main page.


I would ask myself a couple of things before you try to accomplish your
task:

Why does the report take 20 minutes to run? Are you using a bunch of
SQL views? If so, convert the query to a stored procedure or stored
function and see how long it takes.

Now, if the SP still takes long to run and you still want to create a
snapshot of the data, use SQL to run the automated task query, and have
it dump the results into a flat table. Update it as often as you wish.
Then use ASP to simply retrieve the contents of the flat table.

If you still think there are too many rows to retrieve via ASP and
STILL want a static HTM file, I would still use SQL to create the HTML
file and take ASP out the equation all together.

You're reengineering the wheel in what you're trying to do.

Jan 4 '06 #6

Steven Scaife wrote:
Hello

I am creating a reporting system using SQL Server 2000 and ASP, I have
created 4 pages that display the results i want, however the reports take an
average of 20 mins to run and i have been asked to automate them, i decided
to create another ASP page that uses the filesystemobject to create a static
htm file from the main page.

I decided to put all the declarations and includes my main page creation
page, and stripped these from the asp file so i was left with just the body
of the page, i read the body of the page into a variable and tried to do a
replace on the <%= and the %>

htmFile = replace(htmFile, "<%=", " chr(34) &")
htmFile = replace(htmFile, "%>", " & chr(34)")

I also tried doubling the quotes instead of using chr(34) but with either of
them i get unterminated string constant. I want to be able to just read in
the body of the page replacing any <%=%> so that it scales better. I have 4
reports at the moment but this will grow to any number that the business
wants.

As you can see from my code below a solution i have found is to copy the
body text into a variable and escape the string for the insertion of
variables, but as more and more reports get added the messier its going to
get

hopefully i made sense so if anyone knows how to replace the asp tags or a
way of achieving what i want to do i would appreciate the help

almost forgot the reason i am wanting to replace the asp tags is because
when it creates the page it doesn't show any values

my code is as follows

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% option explicit %>

<%
response.expires = "-1000"

'this declaration belongs to the callcentre report
dim dyTotalAppsWrit, dyTotalValueOfApps, dyTotalSourced, dyTotalSumSourced,
dySrceVol, dySrceVal
dim wkTotalAppsWrit, wkTotalValueOfApps, wkTotalSourced, wkTotalSumSourced,
wkSrceVol, wkSrceVal
dim mnTotalAppsWrit, mnTotalValueOfApps, mnTotalSourced, mnTotalSumSourced,
mnSrceVol, mnSrceVal
dim qtTotalAppsWrit, qtTotalValueOfApps, qtTotalSourced, qtTotalSumSourced,
qtSrceVol, qtSrceVal
dim yrTotalAppsWrit, yrTotalValueOfApps, yrTotalSourced, yrTotalSumSourced,
yrSrceVol, yrSrceVal

'this declaration belongs to the LCT BAG Report
dim dyTotalBooked, dyBookingValue, dyBookingFees, dyVisitsVolume,
dyVisitsValue, dyVisitsFees, dySignVolume, dySignValue, dySignFees
dim wkTotalBooked, wkBookingValue, wkBookingFees, wkVisitsVolume,
wkVisitsValue, wkVisitsFees, wkSignVolume, wkSignValue, wkSignFees
dim mnTotalBooked, mnBookingValue, mnBookingFees, mnVisitsVolume,
mnVisitsValue, mnVisitsFees, mnSignVolume, mnSignValue, mnSignFees
dim qtTotalBooked, qtBookingValue, qtBookingFees, qtVisitsVolume,
qtVisitsValue, qtVisitsFees, qtSignVolume, qtSignValue, qtSignFees
dim yrTotalBooked, yrBookingValue, yrBookingFees, yrVisitsVolume,
yrVisitsValue, yrVisitsFees, yrSignVolume, yrSignValue, yrSignFees

'these are needed for the page to function
dim PageTop, CCBagPage, LCTBagPage
%>
<!--#include file="scripts\DBDataScript.asp"-->
<!--#include file="DBArea\loc\location.inc"-->
<!--#include file="include\connection.inc"-->


<snip>

Not an answer to your original question, but you really shouldn't keep
database connection information in .inc files. Unless you have set your
webserver to process them as asp files, they download as text files.
You may just as well post your database details and passwords to
alt.crackers.

/P.

Jan 5 '06 #7

<snip>

Not an answer to your original question, but you really shouldn't keep
database connection information in .inc files. Unless you have set your
webserver to process them as asp files, they download as text files.
You may just as well post your database details and passwords to
alt.crackers.

/P.


This i overlooked :( its the way i've always done it / learnt it but in my
defence its only ever going to be used internally on the company intranet
and there are only 6 IT staff of which only 1 person bar myself would
possibly know this. If it went externally then i probably would have a
problem.

Thanks for the info though will definitely need this as i am building the
company website that is going to be database driven. As all the page data
will be pulled from the db i can do without some one changing the pages. :D
Jan 5 '06 #8
just some info:
pretty sure in iis6 they changed things so it does not matter...
..inc run from browser will not show code.. just http error

I still use .asp for them myself

"Steven Scaife" <sp@nospam.com> wrote in message
news:OH**************@TK2MSFTNGP14.phx.gbl...

<snip>

Not an answer to your original question, but you really shouldn't keep
database connection information in .inc files. Unless you have set your
webserver to process them as asp files, they download as text files.
You may just as well post your database details and passwords to
alt.crackers.

/P.


This i overlooked :( its the way i've always done it / learnt it but in my
defence its only ever going to be used internally on the company intranet
and there are only 6 IT staff of which only 1 person bar myself would
possibly know this. If it went externally then i probably would have a
problem.

Thanks for the info though will definitely need this as i am building the
company website that is going to be database driven. As all the page data
will be pulled from the db i can do without some one changing the pages.
:D

Jan 5 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
5819
by: qwweeeit | last post by:
Hi all, Elliot Temple on the 1 June wrote: > How do I make Python press a button on a webpage? I looked at > urllib, but I only see how to open a URL with that. I searched > google but no...
12
5503
by: Cheval | last post by:
Has anyone had any problems with inter-office automation between MS Word and MS Access in Office 2003? I have recently installed office 2003 in a new folder and have left the older office 2000...
2
1827
by: Alex Maghen | last post by:
Hi. I've seen several KBs on using .NET for MS Office Automation. But I have a particular question: I am developing a somewhat stand-alone .ASPX page which will need to do some relatively simple MS...
9
6035
by: Chubbly Geezer | last post by:
Hope you can help. I have created a mail merge word doc which seems to work fine. When I close and reload it asks if I wish to pull in the data. Great. However, I want to print the results of...
22
2242
by: liya.tansky | last post by:
Hello, I'm developing an intranet (win XP, .NET 2, Visual Studio 2005, Microsoft.Office.Interop.Word.dll in references) and needed to implement find-replace in word doc before sending letter and...
0
9286
by: Sharath | last post by:
Quality Globe is Glad to Offer you the Fast Track course on Automation, QTP Basics and Advanced, and Quality Center Starting Date: June 4th, 2007 Timings: 10 AM to 3:30 PM Duration: 50 Hours ...
0
2343
by: Sharath | last post by:
"Inspired" by the huge success of our first two automation fast track batches We are forced to start third fast track automation batch ...
0
2173
by: Sharath | last post by:
We are glad to inform you that "Inspired" by the huge success of our first three automation fast track batches We are forced to start fourth fast track automation batch ...
0
2052
by: Sharath | last post by:
We are glad to inform you that "Inspired" by the huge success of our first four automation fast track batches We are forced to start fifth fast track automation batch ...
0
2715
by: xrxst32 | last post by:
Hello there, I have some doubts about the best practice for using COM automation, the Runtime Callable Wrapper (RCW) and Marshal.ReleaseComObject. So the question is/are: Do I need to release...
0
7087
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7281
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
737
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
383
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.