您的位置:首页 > 其它

查看使用受管理 RAS 服务器的报表

2008-01-11 10:24 423 查看
此实例说明如何使用查看器标记库来显示使用从受管理报表应用程序服务器中所获得报表源的报表。

查看使用受管理 RAS 服务器的报表

导入相应的类和库
<%@ taglib uri="/crystal-tags-reportviewer.tld" prefix="crviewer" %>


<%@ page import="com.crystaldecisions.sdk.exception.SDKException" %>


<%@ page import="com.crystaldecisions.sdk.framework.ISessionMgr" %>


<%@ page import="com.crystaldecisions.sdk.framework.IEnterpriseSession" %>


<%@ page import="com.crystaldecisions.sdk.framework.CrystalEnterprise" %>


<%@ page import="com.crystaldecisions.sdk.occa.managedreports.*" %>


<%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoObject" %>


<%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoObjects" %>


<%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoStore" %>


<%@ page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSourceFactory2" %>






登录到 Crystal Enterprise 并获取 InfoStore 对象。
在本例中,使用了默认管理员帐户来登录到与应用程序服务器运行在同一计算机上的 Crystal Enterprise 安装。

<%


IEnterpriseSession es = CrystalEnterprise.getSessionMgr().logon("administrator", "", "localhost", "secEnterprise");


????IInfoStore infoStore = (IInfoStore) es.getService("", "InfoStore");






查询想要查看的报表。
IInfoObjects infoObjects = infoStore.query("SELECT * FROM CI_INFOOBJECTS WHERE SI_NAME='World Sales Report'");


????IInfoObject report = (IInfoObject) infoObjects.get(0);






为检索到的报表创建一个 RAS 报表源。
IReportSourceFactory2 reportFactory = (IReportSourceFactory2) es.getService ("", "RASReportFactory");


????Object reportSource = reportFactory.createReportSource(report, request.getLocale());






将 ReportSource 对象缓存在会话变量中。
这样,查看器将能够检索到该对象。

session.setAttribute("ReportSource", reportSource);


%>






创建一个指定查看器名称、报表源类型和报表源变量的 viewer 标记。
在本例中,报表源类型为 reportApplicationServer,并且报表源变量是指您在其中存储了 ReportSource 对象的会话变量。

<html>


<body>


<crviewer:viewer viewerName="CrystalViewer" reportSourceType="reportApplicationServer" reportSourceVar="ReportSource" />


</body>


</html>






注意: ???本例中不需要 report 标记,因为报表源已缓存在会话变量中,并且不需要由查看器检索。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐