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

Passing parameters from ASP to Crystal

Status
Not open for further replies.

welshone

Programmer
Jul 30, 2001
414
GB
Hello,
how can I pass parameters from ASP to Crystal ?

for example, I want to select a company from a dropdown box display a crystal report with with all people in the company selected.


thank you.
 
What are you using to create your drop down menu?

I have developed a page where you can select a value from a drop down menu and it will access the Crystal Report. I used Mircrosoft Frontpage and found that when I licked 'submit' the url was messy and needed cleaned up, I did the following.

You need to write a small asp script (getasp.asp) that will take the information submitted, clean it up, and redirect the browser.

The html for the drop down menu form begins:

<form method=&quot;GET&quot; ENCTYPE=&quot;text/html&quot; name=&quot;selectreport&quot; action=&quot;getpage.asp&quot;>

If this is not clear enough - please let me know and I'll try to explain it a bit better (am in a bit of a rush htis morning!)

- Iain Kemp
iaink@hays.no

 
I have created my page like this :

<FORM METHOD=&quot;POST&quot; name=&quot;selectestablishment&quot; ACTION=&quot;./viewSchool.asp&quot;>
<CENTER>

<Select size=&quot;30&quot; name = &quot;myestablishment&quot;>
<option selected>--Select Establishment--

<% While Not RScompany.EOF

if count = 1 then %>
<option style=&quot;color:red&quot; value=&quot;<%=RScompany(&quot;EstablishmentID&quot;)%>&quot;>
<%count = 2
else %>
<option style=&quot;color:blue&quot; value=&quot;<%=RScompany(&quot;EstablishmentID&quot;)%>&quot;>
<%count = 1
end if %>

<%=RScompany.Fields(&quot;EstablishmentName&quot;)%>

<%
RScompany.MoveNext
Wend
%>

<%
RScompany.Close
MyConncompany.Close
Set RScompany = Nothing
Set MyConncompany = Nothing
%>

</select>

<INPUT TYPE=&quot;Submit&quot; Value=&quot; View Chosen School &quot; Name=&quot;buttonview&quot;>


I want to pass the EstablishmentID through to Crystal Reports, hoe could I do thaT ?
 
what url appears in the browser window when you click &quot;submit&quot;?

what url would properly refer to the crystal report you are targetting?

- iain
 
When I press submit it open viewschool.asp this page looks like this :

<%@ LANGUAGE=&quot;VBSCRIPT&quot; %>

<TITLE>View Schools</TITLE>



<%
' This is the name of the report being used in this example.
' To use a different report, change it here.

reportname = &quot;ViewSchool.rpt&quot;
%>
<%
'=================================================================
'
' - 1 -
' CREATE THE APPLICATION OBJECT
'

If Not IsObject ( session (&quot;oApp&quot;)) Then
Set session (&quot;oApp&quot;) = Server.CreateObject(&quot;Crystal.CRPE.Application&quot;)
End If


' - 2 -
' CREATE THE REPORT OBJECT.
'

Path = Request.ServerVariables(&quot;PATH_TRANSLATED&quot;)
While (Right(Path, 1) <> &quot;\&quot; And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)
Wend


' - 3 -
' OPEN THE REPORT

If isObject(session(&quot;oRpt&quot;)) then
set session(&quot;oRpt&quot;) = nothing
End If

Set session(&quot;oRpt&quot;) = session(&quot;oApp&quot;).OpenReport(Path & ReportName, 1)

' Turn off sepecific report error messages
Set oRptOptions = Session(&quot;oRpt&quot;).Options
oRptOptions.MorePrintEngineErrorMessages = 0

%>
<%
'==================================================================
' Retrieve the Records
'==================================================================
%>
<%
On Error Resume Next
session(&quot;oRpt&quot;).ReadRecords
If Err.Number <> 0 Then
Response.Write &quot;An Error has occured on the server in attempting to access the following data source - &quot; & session (&quot;pubs_ConnectionString&quot;)
Else


'==================================================================
' Create the Page Engine
'==================================================================

If isObject(session(&quot;oPageEngine&quot;)) then
set session(&quot;oPageEngine&quot;) = nothing
End If
Set session(&quot;oPageEngine&quot;) = session(&quot;oRpt&quot;).PageEngine
End If

%>


<!-- #include file=&quot;SmartViewerActiveX.asp&quot; --> %>


This then opens the viewschools crystal report.

my problem is how do I pass the school through to the viewschools report ?


cheers.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top