Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server.ScriptTimeout message in viewer

Status
Not open for further replies.

AurobindoSaha

Programmer
Mar 11, 2004
57
0
0
US
Have anyone came across such message:

The maximum amount of time for a script to execute was exceeded. You can change this limit by specifying a new value for the property Server.ScriptTimeout

I have already set
Server.ScriptTimeout = 1200;

that is 20 minutes. But for a report that takes 5 minutes to run, I see this message in the backgroup of my report viewer. Report displays fine buy this message is shown in multiple line in the background of the report viewer.

I mean the report is printed on top this message in viewer window.

Any idea why this is coming?

Aurobindo

 
Hi,
Please supply:

Version Of IIS server
Version of Crystal Enterprise
report viewer type
Datasource

Also,
Is this custom code that is calling the report?

[profile]
 
Here's the info you are looking for. Any help will be appreciated.


Version Of IIS server: 5.0
Version of Crystal Enterprise: 10.0
report viewer type : DHTML
Datasource Oracle : 9.2.0.1.0

Yes this is a customised page. First runreport.csp runs and then gets redirected to viewrpt2_viewer.csp

Here I have pasted these two pages

---------------------------------------------------
viewrpt2_viewer.csp
---------------------------------------------------
<%@ language=JavaScript codepage=65001%>
<!-- #include file="helper_js.csp" -->
<!-- #include file="checksession_js.csp" -->
<!-- #include file="setcodepage.csp" -->
<!-- #include file="helper_js.csp" -->
<!-- #include file="checksession_js.csp" -->
<!-- #include file="handleerror_js.csp" -->


<%
var Viewer;
var strRedirect;
var GF;
Response.Expires=1;

var iStore = CheckSession(true);

//Adding code for removing the caching problem Incedence #: 2026097

Response.Expires = 0;

Response.Expiresabsolute = -1;

Response.AddHeader("pragma","no-cache");

Response.AddHeader("cache-control", "private");

Response.CacheControl = "no-cache";

Server.ScriptTimeout = 1200;

//End of addition for caching problem


GF=Request.QueryString.Item('gf');

EnsureImageCleanerIsRunning();

viewer1 = Session.Value("viewer1");


viewer1.ReportSource = Session.Value("oReportClientDoc").ReportSource;

if(String(GF)!="undefined")
{
viewer1.ViewTimeSelectionFormula=GF;
viewer1.SelectionFormula=GF;
viewer1.URI="viewrpt2_viewer.csp?gf="+GF;
}
viewer1.IsOwnForm = true;
viewer1.IsOwnPage = true;
viewer1.IsDisplayGroupTree = false;
viewer1.PageToTreeRatio = 5.0;
viewer1.IsDisplayToolbar = true;
viewer1.IsDisplayPage = true;
viewer1.HasRefreshButton = true;

viewer1.ParameterFields = Session.Value("Parameters"); //Added on 21 sept 04 for ondemand report input screen

//Response.Write(viewer1.HyperlinkTarget);
//Response.End();



viewer1.ProcessHttpRequest(Request, Response, Session );

%>

---------------------------------------------------
runreport.csp
---------------------------------------------------
<%@ language=JavaScript codepage=65001%>
<!-- #include file="helper_js.csp" -->
<!-- #include file="checksession_js.csp" -->

<%

function replace(string,text,by) {
// Replaces text with by in string
var strLength = string.length, txtLength = text.length;
if ((strLength == 0) || (txtLength == 0)) return string;

var i = string.indexOf(text);
if ((!i) && (text != string.substring(0,txtLength))) return string;
if (i == -1) return string;

var newstr = string.substring(0,i) + by;

if (i+txtLength < strLength)
newstr += replace(string.substring(i+txtLength,strLength),text,by);

return newstr;
}


function GetViewerType()
{
var Viewer;
switch(GetSubCookie("eportfolio_prefs","vwr"))
{
case 0:
Viewer = "actx";
break;
case 1:
Viewer = "html_frame";
break;
case 2:
Viewer = "html_page";
break;
case 3:
Viewer = "java";
break;
case 4:
Viewer = "java_plugin"
break;
case 5:
Viewer = "nav_plugin";
break;
default:
Viewer = "html_frame"
break;
}

return (Viewer);
}




function CEGetFolderIdByName(infoStore,FolderName)
// this function gets the folder id by it's name.
{
var sSQL;
var oResult;
var iFolderID;
var rsResults;

sSQL = "SELECT * FROM CI_INFOOBJECTS where SI_PROGID ='CrystalEnterprise.Folder'";
/////// Response.write(sSQL +"<br>");
sSQL= sSQL + " and SI_NAME = '" + FolderName + "'";

/////// Response.write(sSQL);
rsResults = infoStore.Query (sSQL);
/////// Response.write("<br>"+ rsResults.Count);
if (rsResults.count >= 1)
{
oResult = rsResults.item(1);
iFolderID = oResult.ID;
}
/////// Response.write("<br>"+iFolderID);
return(iFolderID);
}


function CEGetReportIDByName(infostore,FolderID,ReportName,p_iInstance)
{

var sSQL;
var iReportID;
var rsResults;
var oResult;

sSQL = "SELECT * FROM CI_INFOOBJECTS where SI_PROGID ='CrystalEnterprise.Report'";
sSQL+= " and SI_NAME = '" + ReportName + "' ";
sSQL+= " and SI_INSTANCE=" + p_iInstance;

/////// Response.Write("<br>Report Name="+ ReportName+"<br>FolderId = "+FolderID);

if (FolderID != 0)
sSQL += " AND SI_PARENT_FOLDER = " + FolderID;


/////// Response.Write("<br>"+ sSQL);
rsResults = infostore.Query (sSQL);

/////// Response.write( "<BR>"+rsResults.Count);

if (rsResults.count >= 1)
{
oResult = rsResults.item(1);
iReportID = oResult.ID;
}
/////// Response.write( "<BR>"+iReportID);
return(iReportID );
}


function GetLatestReportInstance (oInfoStore, p_sReportName, p_FolderId)
{
var sSQL;
var oResult;
var iInstanceID ;
var rsResults;
/////// Response.Write("<br> In Get Latest Instance");

sSQL = "SELECT * FROM CI_INFOOBJECTS WHERE SI_PROGID = 'CrystalEnterprise.Report' AND SI_INSTANCE = 1 AND SI_NAME = '" + p_sReportName + "'";
sSQL = sSQL + " AND SI_PARENT_FOLDER = " + p_FolderId;

/////// Response.Write("<br>"+ sSQL);

rsResults = oInfoStore.Query (sSQL) ;

oResult = rsResults.item(rsResults.count);

iInstanceID = oResult.ID;

return(iInstanceID);

}


function CEReportURLBasic()
{
// This function will create the basic report URL with APS token. Rest of the parameters will be added as and when needed.
var sBasicURL;
// sBasicURL = "viewrpt.cwr?apstoken=" + Server.UrlEncode(GetCookie("ePortfolio_logontoken")) + "&init=" + GetViewerType() +"&id=" + p_iReportID;
// sBasicURL = "viewrpt.cwr?apstoken=" + GetCookie("ePortfolio_logontoken") + "&init=" + GetViewerType() +"&id=" + p_iReportID;
sBasicURL = "viewrpt.cwr?apstoken=" + Server.UrlEncode(GetCookie("ePortfolio_logontoken"));
/////// Response.Write("<br>"+sBasicURL);
return(sBasicURL);
}


var strRedirect;
var GF;
var iStore;
var strToken;
var strReportName;
var strFolderName;
var GF;

Response.Expires=1;

iStore = CheckSession(false);

strReportName = Request.QueryString.Item("REPORTNAME");
strFolderName = Request.QueryString.Item("FolderName");
GF=Request.QueryString.Item("gf");

/////// Response.Write("<BR>"+GetCookie("ePortfolio_logontoken")+"<br>");

// I will put this code back for the logon token.
//*******************************************************************************************************************
var strToken = "";
var strViewer = "";
if( iStore && typeof(iStore) == "object" )
{
strToken = GetCookie("ePortfolio_logontoken");
if(strToken == "")
{
try
{
var ltm = iStore.EnterpriseSession.LogonTokenMgr;
strToken = ltm.CreateLogonTokenEx("", 480, -1);
SetCookie("ePortfolio_logontoken", strToken);
}
catch(e)
{
// just continue on, the viewer will ask for logon if there's no token
}
}
// strViewer = GetViewer();
}
//*******************************************************************************************************************
///////Response.Write("<BR>"+strToken+"<br>");


// Get the Folder id first
iFolderID = CEGetFolderIdByName(iStore,strFolderName);

/////// Response.Write("<br>"+ iFolderID);
iStore = CheckSession(false);

iReportID=CEGetReportIDByName(iStore,iFolderID,strReportName,0);

// Keep on generating the URL as and when we proceed.
var sURL=CEReportURLBasic();
/////// Response.Write("<br>"+ sURL + "<br>");


// Adding the viewer in the url

var viewer = GetViewerType();

// checking if we need to add connect in the viewer or not based on the gf parameter in the query string

if(String(GF)=='undefined')
{
viewer+=":connect";
}
else
{
var iReportID = GetLatestReportInstance(iStore,strReportName,iFolderID);
}
// Here the code needs to be changed so that we can create the viewer object and then use ParameterFieled Object
// for changing the parameter values in the report.


EnsureImageCleanerIsRunning();
viewer1 = Server.CreateObject( "CrystalReports.CrystalReportViewer" );

// Response.Write("<br> Viewer object created");
//*******************************************************************************************




var rptSrcFactory = iStore.EnterpriseSession.Service ("", "RASReportFactory");
var oReportClientDoc = rptSrcFactory.OpenDocument(iReportID);

var rptFields = oReportClientDoc.DataDefinition.ParameterFields;

/////// Response.Write("<br>"+rptFields.count);

var ObjFactory = Server.CreateObject("CrystalReports.ObjectFactory");

var parameterfield = ObjFactory.CreateObject("CrystalReports.ParameterField");
var parameterfieldvalue = ObjFactory.CreateObject("CrystalReports.ParameterFieldDiscreteValue");
var value = ObjFactory.CreateObject("CrystalReports.ParameterFieldDiscreteValue") ;

for (var i=0;i<rptFields.count;i++)
{
/////// Response.Write("<br>" + rptFields.Item(i).Name + "="+ Request.QueryString(rptFields.Item(i).Name) + " Type = " + rptFields.Item(i).Type);
rptFields.Item(i).CopyTo(parameterfield);

switch(parameterfield.Type)
{

case 6: //Number type Parameter
value = Number(Request.QueryString(rptFields.Item(i).Name));
break;
case 11:// String Type Parameter
value = String(Request.QueryString(rptFields.Item(i).Name));
break;
case 15:// Date type Parameter
value = Request.QueryString(rptFields.Item(i).Name);
break;
case 9:// Date type Parameter

value = String(Request.QueryString(rptFields.Item(i).Name));

if (value == 'undefined') {
//if the querystring value is undefined we'll get it from the defaultvalues
value = rptFields.item(i).DefaultValues.Item(0).value;
}
else
value = Request.QueryString(rptFields.Item(i).Name);

break;

}
/////// Response.Write("<br>Modifying Current Value Now");
parameterfield.CurrentValues.Add(value);
/////// Response.Write("<br>Modifying Value Now");
oReportClientDoc.DataDefController.ParameterFieldController.Modify (rptFields.Item(i),parameterfield);


}

// var viewer1 = Server.CreateObject( "CrystalReports.CrystalReportViewer" );


//viewer1.HyperlinkTarget = "_blank";

Session.Value("viewer1") = viewer1;

Session.Value("oReportClientDoc") = oReportClientDoc;

Session.Value("GF")=GF;

Response.Redirect("viewrpt2_viewer.csp?gf="+GF);


%>
 
Hi Turkbear,
I am waiting for your response. Any clue from your side
Thankx
Aurobindo
 
Hi,
In IIS you can also set the timeout for an asp script..
In the Management Tool or in the IIS admin tool right-click the your web server( probably default if you have not renamed it) - go to Home Directory - configuration..App Options and look for the setting for ASP script timeout..
But I also noticed this:

<!-- #include file="helper_js.csp" -->
<!-- #include file="checksession_js.csp" -->
<!-- #include file="setcodepage.csp" -->
<!-- #include file="helper_js.csp" -->
<!-- #include file="checksession_js.csp" -->
<!-- #include file="handleerror_js.csp" -->


Why so many repeated Includes? They may be causing the problem - eliminate duplicates and try again..


[profile]
 
Hi,

1. I removed the repeated include
2. Checked the ASP ScriptTimeout as you told to be 1200

No help yet. The Report takes 5min 30 sec to run and shows the ScriptTimeout message.

After searching other thread I found two threads where they mention to change the registry key.

H_L_M/Software/Crystal Decisions/10.0/Web Component Server/Components/csp/scripttimeout

Set that to 1200. Restarted IIS services and all Crystal Servers.

No help even after that.

Any other sugession?

Thanks

Aurobindo
 
Hi,
One ( or more) of the include files may(must?) have some error that is causing this, since the report does run..

To check this,you may have to build a test page,and try adding 1 of the include files at a time until it errors out..

[profile]


 
A quick and probably rediculous question - we are running IIS 5.0 and I was wondering about the Client Scripting settings. We are using the default eportfolio portal and the default scripting value is "VBScript". Is this correct or should it be set to "JavaScript", or for that matter does it really matter?

Kenneth Hartman
Manager, EIS
Hughes Network Systems
 
I would set it to JavaScript (JScript on IIS I think) to support all clients, but it really does not matter as the client script should always be explicity set in the code.

Kingfisher [CECP]
 
Hi,

For me this issue got solved when I added the line

Server.Scripttimeout = 1200;

in all the csp viewer pages.



Regarding coding in mixture of Javascript and VB Script, I would prefer to set IIS>Default Properties>Home directory Tab>Application Settings>Configuration>App Options Tab>Deafult ASP language to Javascript. Also for script timeout option it can be set here, In my case I set it to 1200 (20 minutes)

Then if VB script needs to be used then in the code you can write that in code in the following format.

<%@ language=VBScript codepage=65001%>
...............
...............
...............//Your Code goes here
...............
</SCRIPT>

Others, please rectify me if I am wrong.

Thanks

Aurobindo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top