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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Build a "standard page" to display differnt kind of reports

Status
Not open for further replies.

gonsales

Programmer
Oct 9, 2003
18
ES
Hi!.
We've got different kind of reports in a CE9 system: with parameters, with selection formula, without parameters...and I should do a single ASP page to see that reports in our intranet.
I've seen "simple" pages to see "simple" reports with Crystal viewers.
Where could I find a "standard page" to display all kind of reports?? (if exists)
thanks!!
 
Hi,
Using a combination of asp,javascript and csp you should
be able to create a 'generic' set of pages that can handle many variants - the ultimate goal is to pass sufficient info to viewrpt.cwr to properly ( and securely, if needed) call the desired report (e.g. the Report Id#, any parameters needed, the view type, the authentication info, etc)

How that gets passed is up to the custom designer...

I use somethng like the folowing JavaScript function and pass it the needed parameters - (Using CE 8.5):

Code:
function RunRpt(p,m,f){
amper = &quot;<%=Server.UrlEncode(&quot;&&quot;) %>&quot;
var progid=&quot;CrystalEnterprise.Report&quot;
 if (f == 1) {
  var pstr = amper + &quot;promptex-EmpNbr=&quot; + p
 }
 if (f == 2) {
  var pstr = amper + &quot;promptex-jcode=&quot; + p
 }
  windowprops = &quot;fullscreen=no,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes&quot;;
 var strUA = &quot;<%=Request.ServerVariables(&quot;HTTP_USER_AGENT&quot;) %>&quot;
 if (strUA.indexOf(&quot;IE&quot;) > 1) {
  istr = &quot;actx&quot;
 }
 else
 {
 istr = &quot;java&quot;
 }
  reportWindow = window.open(&quot;empviewerV3.csp?qid=&quot; + pstr + &quot;&progid=&quot; + progid + &quot;&rid=&quot; + m + &quot;&invr=&quot; + istr,&quot;rptWindow&quot;,windowprops);
}

That function calls the following csp page:

Code:
<html>
<head>

<% @language=JavaScript codepage=65001%>
<!-- #include file=&quot;setcodepage.csp&quot; -->
<!-- #include file=&quot;helper_js.csp&quot; -->

<script language=Javascript>
function init()
{
	document.forms[&quot;redirForm&quot;].submit();
}
</script>
</head>

<body onload=init()>

<%
var action, tokenName;
var progid = Request.QueryString.Item(&quot;progid&quot;);

if(progid = &quot;CrystalEnterprise.Report&quot; )

{
                     
        action = &quot;viewrpt.cwr?id=&quot; + Request.QueryString.Item(&quot;rid&quot;) + Request.QueryString.Item(&quot;qid&quot;) + &quot;&init=&quot; + Request.QueryString.Item(&quot;invr&quot;) + Server.URLEncode(&quot;:connect&quot;);
        tokenName = &quot;apstoken&quot;;
	
	
        
}
else
{
	action = &quot;infoobject.cwr?id=&quot; +  Request.QueryString.Item(&quot;id&quot;) + &quot;&action=0&quot;;
	tokenName = &quot;WCSLOGONTOKEN&quot;;
}





Response.Write(&quot;<form name='redirForm' method='post' action='&quot; + action + &quot;'>\n&quot;);
Response.Write(&quot;<input type='hidden' name='&quot; + tokenName + &quot;' value=\&quot;&quot; + Server.HTMLEncode(GetCookie(&quot;logontoken&quot;)) + &quot;\&quot;>\n&quot;);
Response.Write(&quot;</form>\n&quot;);
%>

</body>
</html>

This is just one of many ways do this..
Our current approach ( still being refined) is to use csp queries and JavaScript functions to dynamically build a 'prompting' page based on the selected reports parameter list...

[profile]

 
Thanks, but...you're using &quot;URL Reporting&quot; and it's &quot;deprecated&quot; on CE 9...(unfortunately).
I should use &quot;Crystal COM Viewers&quot; to display reports. And it's more difficult than URL reporting (unfortunately, too)
 
Hi, Yes - the fact that one of the most flexible methods of calling a report is being gradually eliminated ( altho' it will still work in V9 ) is one of the reasons I may not recommend moving to v9 ( even tho' we have it)..

[profile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top