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!

Parameters and ASP

Status
Not open for further replies.

janedane

Programmer
Mar 8, 2004
22
IE
Hi All,
I am trying to call a report through the browser using the aspxmps9 supplied by business objects. I am using the simplesetlogon.asp method.

When I call a report with no parameters this works fine. However if I have a parameter, I am not prompted to enter a parameter and the report comes up empty of records.

Does anyone know what method I can use for parameters ( inputting them at run-time opposed to passing them through ASP.)

Any help would be greatly appreciated.

Jane Danes

Jane Danes
 
Crystal will not display a prompt screen when executed via ASP.

You will need to create your own screen to for the suser to enter the parameter values and then pass these to the rep;ort ASP page in code

here is a sample html page used enter and then call the report.asp

Code:
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="[URL unfurl="true"]http://www.w3.org/TR/REC-html40">[/URL]

<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=File-List href="./MyReport-parameters_files/filelist.xml">
<link rel=Edit-Time-Data
href="./MyReport-parameters_files/editdata.mso">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><!--[if gte mso 9]><xml>
 <o:DocumentProperties>
  <o:Author>Gary.Parker</o:Author>
  <o:Revision>1</o:Revision>
  <o:TotalTime>0</o:TotalTime>
  <o:Created>2004-06-11T15:47:00Z</o:Created>
  <o:Pages>1</o:Pages>
  <o:Words>33</o:Words>
  <o:Characters>189</o:Characters>
  <o:Company>K2 Direct Mail </o:Company>
  <o:Lines>1</o:Lines>
  <o:Paragraphs>1</o:Paragraphs>
  <o:CharactersWithSpaces>232</o:CharactersWithSpaces>
  <o:Version>9.2720</o:Version>
 </o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:Zoom>0</w:Zoom>
 </w:WordDocument>
</xml><![endif]-->
<style>
<!--
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0cm;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
p
	{font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
@page Section1
	{size:595.3pt 841.9pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	mso-header-margin:35.4pt;
	mso-footer-margin:35.4pt;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="2050"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1"/>
 </o:shapelayout></xml><![endif]-->
</head>

<body bgcolor=white lang=EN-GB style='tab-interval:36.0pt'>

<div class=Section1>

<form action="EC%20Acquisitions-dynamic.asp" method=POST
enctype="application/x-[URL unfurl="true"]www-form-urlencoded"[/URL] name=parmform>

<table border=1 cellpadding=0 style='mso-cellspacing:1.5pt'>
 <tr>
  <td style='padding:.75pt .75pt .75pt .75pt'>
  <p class=MsoNormal>Enter Start Date to Query i.e. 01/01/2003 </p>
  </td>
  <td style='padding:.75pt .75pt .75pt .75pt'>
  <p class=MsoNormal><INPUT TYPE="text" MAXLENGTH="11" SIZE="11" NAME="P1"></p>
  </td>
 </tr>
 <tr>
  <td style='padding:.75pt .75pt .75pt .75pt'>
  <p class=MsoNormal>Enter End Date to Query i.e. 31/01/2003 </p>
  </td>
  <td style='padding:.75pt .75pt .75pt .75pt'>
  <p class=MsoNormal><INPUT TYPE="text" MAXLENGTH="11" SIZE="11" NAME="P2"></p>
  </td>
 </tr>
 <tr>
  <td colspan=2 style='padding:.75pt .75pt .75pt .75pt'>
  <p align=center style='text-align:center'><INPUT TYPE="submit" ACTION="MyReport.asp" VALUE="View Report" METHOD="POST" NAME="B1"></p>
  </td>
 </tr>
</table>

</form>

</div>

</body>

</html>

then in the MyReport.asp

use these values to run the report

Code:
set session("ParamCollection") = Session("oRpt").Parameterfields 

set Param1 =  session("ParamCollection").Item(1)
ParamValue1 = Request("P1")
Call Param1.SetCurrentValue (CStr(ParamValue1), 12)


set Param2 =  session("ParamCollection").Item(2)
ParamValue2 = Request("P2")
Call Param2.SetCurrentValue (CStr(ParamValue2), 12)

Hope this points you in the right direction.

Gary Parker
MIS Data Analyst
Manchester, England
 
Thanks for that, I have this working fine when my report does not require a database logon HOWEVER when I add the code

<%
'==================================================================
'==================================================================
' WORKING WITH SETLOGONINFO
'
' The datasource here is called "Pubs Sample Database". It is a System
' Datasource (DSN), and points to the "pubs" database, which is installed
' with SQL Server. You will also need to change your user id and
' password.

'Create a reference to the tables collection of the main report
Set mainReportTableCollection = Session("oRpt").Database.Tables


For Each mnTable in mainReportTableCollection
With mnTable.ConnectionProperties
.Item("user ID") = "user"
.Item("Password") = "welcome"
.Item("DSN") = "Sales"
.Item("Database") ="demo"
End With
Next

'==================================================================
'==================================================================
%>

It just stops working.

Any Ideas why?

Jane
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top