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

Passing User id and password to sub report

Status
Not open for further replies.

CrystalUser1

Programmer
Sep 16, 2004
138
US
Hi,

We are using crystal reports 8.5 and oracle 10g. Created reports using ODBC. We are calling the reports from the web environment and the asp file invokes the report. Recently i created a report which has a sub report. How to pass the user id and password credentials to the sub report. My Asp file is copied below: what should be added in the following file to pass the user id and password to the sub report without prompting that when invoking the report.

thanks


<HTML>
<HEAD>
<TITLE>Crystal Report Viewer</TITLE>
</HEAD>
<SCRIPT SRC="ftCommonArea.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
var rptName = "<%= Request.QueryString("report") %>"

</SCRIPT>
<BODY BGCOLOR=C6C6C6 LANGUAGE=VBScript>
<FORM>
<INPUT type="button" value="Back to Employee Reports Menu"
onClick="window.close() ; ">
</FORM>
<OBJECT ID="CRViewer"
CLASSID="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
WIDTH=100% HEIGHT=95%
CODEBASE="<PARAM NAME="EnableDrillDown" VALUE=1>
<PARAM NAME="EnableExportButton" VALUE=1>
<PARAM NAME="DisplayGroupTree" VALUE=1>
<PARAM NAME="EnableGroupTree" VALUE=1>
<PARAM NAME="EnableAnimationControl" VALUE=1>
<PARAM NAME="EnablePrintButton" VALUE=1>
<PARAM NAME="EnableRefreshButton" VALUE=0>
<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 Seagate Software ActiveX Viewer is unable to create it's resource objects. To rectify this problem, please install Internet Explorer 4.0 or install DCOM for Windows 95 and the latest Microsoft Scripting Engine. These files are available at Microsoft's web site."
CRViewer.ReportName = rptPath+rptName
else
Dim webSource0
Set webSource0 = CreateObject("WebReportSource.WebReportSource")
webSource0.ReportSource = webBroker
webSource0.URL = rptPath + rptName
webSource0.PromptOnRefresh = True
webSource0.AddParameter "user0", rptUserID
webSource0.AddParameter "password0", rptPassword
<%
dim numParm
numParm = 0

numParm = Int(Request.QueryString("nParms"))

numParm = Int(numParm) - 1
For i = 0 to numParm
name = "prompt" & i
value = Request.QueryString(name)
Response.write "webSource0.AddParameter """ & name & """, """ & value &"""" & vbcrlf

Next
%>
webSource0.AddParameter "promptOnRefresh", "1"
CRViewer.ReportSource = webSource0
end if
CRViewer.ViewReport
End Sub

-->
</SCRIPT>
</body>
</html>
 
I don't know Oracle, but anything that's in the main report can be passed to the subreport, using Edit > Subreport Links. Note that it will automatically add the link as a record-selection in the subreport, additional to any test you already have.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
[yinyang] Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top