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

Passing a Parameter in URL

Status
Not open for further replies.

masif2000

Programmer
Jul 21, 2005
9
0
0
US
This has to be a very simple question and I must be missing something very obvious here.

I have Crystal Reports Dev XI on my dev machine and BO Ent XI on the server.

I created a simple report (using crystal report developer version XI) that runs off of one table only using OLE DB (ADO) connection. This report is based on a parameter that user enters when prompted. That paramater is tied to a field in the table (using forumla i.e. field1=?promptfield1val). I published the report in Business Objects Ent. XI to a public folder. This works fine. The user is prompted when trying to view the report and the result is displayed accordingly in the Report's BO web viewer.

Now, upong reading the documentation, I am trying to pass the parameter as part of the URL using prompt# or promptex but it still keeps prompting the user no matter what and ignores whats is passed with URL. I am trying launch the web viewer from another web application of mine and in some cases, I already know the value of the parameter. So I want to pass it with the URL instead of having the user to enter it. I may be new to CR and BO but this is pretty basic stuff.

I have tried all of the following:







What the heck am I doing wrong???
 
Hi,
A couple of things:
The Parameter name is Case-Sensitive so be sure, when using the promptex-ParamName ( NOT Fieldname), that you match it perfectly.

So, then use ( not with the italics of course):

ParameterName =100000067



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Thanks for the help but I am still getting the same result. It still prompts me for the parameter value. The formula is correct because when I enter the value in the prompt, it brings back the expected results.

I am using the Parameter name in the URL, not the field name.
 
this is what i do...and it works...

server/businessobjects/enterprise11/Infoview/Report/viewrpt.aspx?id=724&promptex-@staffID=977

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
Hi,
I have tried and got the same results as you did..Maybe XI no longer supports that method of passing the parameter...

Check with BObj's support.

We use a custom coded asp page ( based on Crystal samples) to do that:
Code:
<HTML>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=charset=UTF-8">
<BODY>
<%
'===================================================================
' AUTHOR - SG, KA
' CREATED - March 31, 2004
' Modified by Turkbear July 2005 to make it an asp page
' PURPOSE - This sample ASP application demonstrates how to view 
'           on demand a report with a multiple value parameter 
'           using the Crystal Enterprise 11 COM SDK.
' DESCRIPTION
'	- Define CE Logon Variables
'   - Create the Enterprise Session Manager and iStore objects
'   - Query the CMS for a report to view
'	- Create and pass parameter for the report
'	- Create the viewer object and view the report
'==================================================================

'Declare the CMS Logon Variables
Dim CMS
Dim Username
Dim Password
Dim Authtype

'Set CMS logon credentials - change these to match your particular CE environment
CMS = "cmsname"
Username = "ReadOnly"
Password = "sample123"
Authtype = "secEnterprise"


'Declare variables for Enterprise Session
Dim oEnterpriseSessionMgr
Dim ceSession
Dim iStore
'Get the values
Rid = Request.QueryString("ReportID")
NbrParams = Request.QueryString("NumParens")
If NbrParams > 0 then
ValStr   = Request.QueryString ("Pvals")
NameStr = Request.QueryString ("Pnames")
arrVals = Split(ValStr,";")
arrNames = Split(NameStr,",")
End If


'Load the Enterprise Session Manager

Set oEnterpriseSessionMgr = Server.CreateObject("CrystalEnterprise.SessionMgr")

'Logon to the CMS and create iStore object
Set ceSession = oEnterpriseSessionMgr.Logon(Username, Password, CMS, Authtype)
Set iStore = ceSession.Service("","InfoStore")

'Declare InfoObject Variable
Dim Reports
Dim Report

'Query the CMS for the report you wish to view
Set Reports = iStore.Query("Select * from CI_InfoObjects Where SI_ProgID = 'CrystalEnterprise.Report' and SI_ID='" & Rid & "'")
Report = Reports.Item(1).Properties("SI_ID")

'Declare the report parameter variables
Dim reportParameters
Dim fields
Dim tmpParameter
Dim value
Dim NewSpec()
Dim PType()
Dim inx 
Dim pcnt
pcnt = 0
inx = 0

'Get the report parameter(s) using the plugin interface
Set reportParameters = Reports.Item(1).PluginInterface("Report").ReportParameters
If NbrParams > 0 then
                       ' Build an array structure to determine the parameter type
For each parameter in reportParameters
	  pcnt = pcnt + 1
	  Next
	For each parameter in reportParameters
	 ReDim PType(pcnt)
	 PType(inx) = parameter.ValueType
	 inx = inx + 1
	 Next

	'Create a new Fields Collection Object
	Set fields = CreateObject("CrystalReports.Fields")
	
	for n = 0 to (NbrParams - 1)
	' Create a temporary parameter field 
		Set tmpParameter = CreateObject("CrystalReports.ParameterField")
		' Create list of values for this parameter
		arrPvals = Split(arrVals(n),",")
		Max = UBound(arrPvals)
		ReDim NewSpec(Max)
		' Create a parameter value oblect for each value in list 
		for v = 0 to UBound(arrPvals)
		set NewSpec(v)   =  createobject("CrystalReports.ParameterFieldDiscreteValue")  
		Next
		i = 0 ' initialize counter for value list array access
		 for each val in arrPvals  ' assign the value to the parameter
		    if PType(n) = 3 then
		       NewSpec(i).value = cDate(val)
		    else
		         NewSpec(i).value = Trim(val)
		   end if
		        tmpParameter.CurrentValues.Add NewSpec(i)
		              i = i + 1     ' increment counter
		              		 Next
			 
		tmpParameter.name = arrNames(n)
	Fields.Add tmpParameter
 Next ' parameter
  
End If

'Declare the Report App Factory and Report Document Objects
Dim rptAppFactor
Dim reportDocument

'Create the Report App Factory and Report Document Objects
Set rptAppFactory = iStore.EnterpriseSession.Service("","PSReportFactory")
Set reportDocument = rptAppFactory.OpenReportSource(Report)


'Declare the viewer object variable
Dim Viewer

'Create a viewer object and view the report
Set Viewer = CreateObject("CrystalReports.CrystalReportInteractiveViewer")
With Viewer
  .reportSource = reportDocument
  .HasBooleanSearchButton = False
  .HasCrystalLogo = False
  If NbrParams > 0 then
  .ParameterFields = Fields
  End If
  .HasRefreshButton = True
  .IsDisplayGroupTree = False
  .HasPrintButton = true
  .PrintMode = 0 ' disable activeX Printing - set to 1 to enable (may require plug-in is set to 1)
  .IsOwnPage = true
End With
'


Set Session("viewer") = Viewer

Response.Redirect("viewprint.asp")

 

%>
</BODY>
</HTML>
Viewprint.asp is:
Code:
<%
option explicit
dim viewer
set viewer = session("viewer")
'Error handle
on error resume next
Viewer.ProcessHTTPRequest Request, Response, Session

if err.number <> 0 then
  response.write "Failed to view report" & "</BR>"
  response.write "error number: " & err.number & "</BR>"
  response.write "error description: " & err.description
end if
%>


and call it from a URL, like this:

This method works in both 10 and XI..




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Thanks alot. I am going to try this.

Wouldn't the prog Id change for XI though? or is it still
Server.CreateObject("CrystalEnterprise.SessionMgr")

Another question... with your custom code example above, you wouldn't even need the BO (or CR Server for that matter) installed on the server correct? You would just need CR Dev.
 
XI still supports the query string method...

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
Hi,
Seems to work ok as is...

I have not tried to see if just the SDK Developer components were needed...We use this method just for simple reports ( or we use these pages as the last 2 pages of a series of other custom pages providing for extensive set of user interfaces that handle security, prompting for Parameter values and providing drop-down lists of values for them, etc.), while using BOE's extensive security, scheduling an other functions for most reports.

With these 2 pages we can allow our web developers to use any user interface method they want as long as it results in that type of URL being generated - they can all use the same 'root'
( ) and concatenate their specific items to the end of it..Redirect to the resultant URL and, Viola!, the report [licklips].



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Checkai,

I tried your suggestion.... here is the detail

first I wanted to see if the link u provided is accessible...


I got the following error:

A report id or report source session variable is required.

So then I tried the following:


like you suggested, without parameter in URL first though. I got the following error

The page you requested is not found

The address in the address bar changed to the following:

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top