SQL, ASP and Crystal Reports
I have a report in Crystal that I need to let users view/print via the web. The report is based on a view in SQL that will remain constant. However, I need the report to be populated with a subset of that view based on user information. I've read the technical articles on Crystal's website about creating a TTX file...that's fine, but I don't need to create a new report...I want to use the one I've already created. I can generate a sql query string with the user information through asp. But I can't figure out how to get it to the report. I'm using the following code to access the viewer. I'm not (and prefer not to have to) access the RDC. My users don't need to be able to create a report...just view the report we've created populated with their subset of the data. Thanks!
<html>
<head>
<TITLE>Region 7</TITLE>
</head>
<SCRIPT LANGUAGE="JavaScript">
</SCRIPT>
<BODY BGCOLOR=C6C6C6 LANGUAGE=VBScript topmargin=0 leftmargin=0>
<OBJECT ID="CRViewer"
CLASSID="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
WIDTH=100% HEIGHT=99%
CODEBASE="/viewer/activeXViewer/activexviewer.cab#Version=8,5,0,217">
<PARAM NAME="EnableDrillDown" VALUE=1>
<PARAM NAME="EnableExportButton" VALUE=1>
<PARAM NAME="DisplayGroupTree" VALUE=0>
<PARAM NAME="EnableGroupTree" VALUE=0>
<PARAM NAME="EnableAnimationControl" VALUE=1>
<PARAM NAME="EnablePrintButton" VALUE=1>
<PARAM NAME="EnableRefreshButton" VALUE=1>
<PARAM NAME="EnableSearchControl" VALUE=1>
<PARAM NAME="EnableZoomControl" VALUE=1>
<PARAM NAME="EnableSearchExpertButton" VALUE=0>
<PARAM NAME="EnableSelectExpertButton" VALUE=0>
</OBJECT>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub window_onLoad()
Page_Initialize()
End Sub
Sub Page_Initialize
On Error Resume Next
Dim webBroker
Set webBroker = CreateObject("WebReportBroker.WebReportBroker")
if err.number <> 0 then
window.alert "The Crystal ActiveX Viewer is unable to create it's resource objects."
CRViewer.ReportName = "/Compass/TAKSTracker/TAKSReport2.rpt"
else
Dim webSource0
Set webSource0 = CreateObject("WebReportSource.WebReportSource")
webSource0.ReportSource = webBroker
webSource0.URL = "/Compass/TAKSTracker/TAKSReport2.rpt"
webSource0.PromptOnRefresh = True
CRViewer.ReportSource = webSource0
CRViewer
end if
CRViewer.ViewReport
End Sub
-->
</SCRIPT>
<OBJECT ID="ReportSource"
CLASSID="CLSID:F2CA2115-C8D2-11D1-BEBD-00A0C95A6A5C"
HEIGHT=1% WIDTH=1%
CODEBASE="/viewer/activeXViewer/activexviewer.cab#Version=8,5,0,217">
</OBJECT>
<OBJECT ID="ViewHelp"
CLASSID="CLSID:BD10A9C1-07CC-11D2-BEFF-00A0C95A6A5C"
HEIGHT=1% WIDTH=1%
CODEBASE="/viewer/activeXViewer/activexviewer.cab#Version=8,5,0,217">
</OBJECT>
<OBJECT ID="ReportParameter"
CLASSID="CLSID:71C140F3-1A84-430b-9035-68815582DC79"
HEIGHT=1% WIDTH=1%
CODEBASE="/viewer/activeXViewer/reportparameterdialog.cab#Version=8,0,2,672">
</OBJECT>
</body>
</html>
|