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!

CR10 & CE10, can I pass parameters to reports in the CE Env? 1

Status
Not open for further replies.

eo

MIS
Apr 3, 2003
809
Hi

In the "old days" (CR9 stored on a web server), we could pass parameters for the data selection and the format from our OS.

I was under the impression that with the advent of reports stored on CE10 this not possible any longer.

My problem.

I have a report that shows 3 group level, lets call them Group level High, Medium and Low.

Account Executives must be able to see all data and be able to drill down through the 3 groups.
Middel management must only be able to see Group Medium and Low, and only for their area.
Low management must only see Group 3 and detail, and only for their area.

This whole scenario would be manageable with three reports and access to report folders. BUT group medium is made up for approx 50 categories. I am in no mood to do 50 seperate reports.

We are thus thinking of passing the user detail, which could act as report parameters from the OS. But not sure if this is possible if the reprts are stored in CE10??? Is this indeed the case?

Secondly, is it possible to pass a link directly to a report? I think it should be as this is what the alert function does.

Any help greatly appreciated.

EO
Hertfordshire, England
 
Hi,
How did you do that in 9?

Also, what do you mean by:
'pass a link directly to a report'

Pass from where to where?

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
We created a URL in the application (it was a bespoke operating system) which passed the parameters to the report.
That acted like a person clicking on a link to the report, and in the report viewer was asked for the report parameters. But insted of him filing these parameters in, the url passed them parameters and the results was displayed automatically. Making the whole solution much more seamless.



EO
Hertfordshire, England
 
Hi,
That method ( or a variant of it) still works in 10 ( and in XI, as well):

We use it for those reports/users that want the ActiveX of Java viewers and not CE's standard DHTML ones..

An example would be something like:

( viewrpt.asp for XI)?id=50542&apsuser=Username&apspassword=UserPass&apsauthtype=secEnterprise&promptex-EmpNbr="ALL"&promptex-StartDateStr="07/03/2006"&promptex-EndDateStr="07/05/2006"&init=actx



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Thanks for this, but I will need some translating so that I can implement over here:

Code:
[URL unfurl="true"]http://<YourServer>/<yourCEviewerdirectory>/viewrpt.cwr([/URL] viewrpt.asp for
XI)?id=50542&apsuser=Username&apspassword=UserPass&apsauthtype=
secEnterprise&promptex-EmpNbr="ALL"&promptex-StartDateStr=
"07/03/2006"&promptex-EndDateStr="07/05/2006"&init=actx

the url passed via email to the user as a scheduled report link is:
Code:
[URL unfurl="true"]http://aflon1cry01/crystal/enterprise10/viewer/viewer.csp?cuid=[/URL]
AeLgo23CZBlHgg2f4_D40lg

Could we break the code down so that I could apply?
equals

***

id=50542&apsuser=Username&apspassword=UserPass&apsauthtype=secEnterprise
what does that id stand for?
is apsuser to be used for the CE login?
is apspassword to be used for the CE login?
we use NT so I suppose secEnterprise should be secWindowsNT?
CE10 does not use asp, but csp, are you sure this is correct?

***

&promptex-EmpNbr="ALL"
&promptex-StartDateStr="07/03/2006"
&promptex-EndDateStr="07/05/2006"&init=actx
Are these the three parameters in the report?

Thanks for this.


EO
Hertfordshire, England
 
Hi,
ID is the Published reports ID# ( assigned to it when published)

The apsname, etc are CE login
The apsauthtype will vary depending on the Username, but, if using NT authentication,it would be SecWinNT

.csp for CE10, .asp for XI ( csp IS actually asp but CE's variant)
.cwr for both....

Correct on the parameters..





[profile]

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

This is my URL. When it is used it rather takes the user to the actual Country parameter as opposed to the actualy Country as stated in the URL

Code:
[URL unfurl="true"]http://aflon1cry01/crystal/enterprise10/viewer/en/viewreport.csp?id=36306204&apsuser=Administrator&apspassword=&apsauthtype=secEnterprise&promptex-Country="France"&init=actx[/URL]

EO
Hertfordshire, England
 
Hi,
By
takes the user to the actual Country parameter
do you mean that the user is prompted for a Country value even though one is being passed in the URL?

Try without the quotes around France, maybe..But the URL you posted should have worked, assuming the parameter is named Country ( case matters)..




[profile]

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

There was a slight error in the code I posted below. I thought I cracked it, but no. The revised code...
Code:
[URL unfurl="true"]http://aflon1cry01/crystal/enterprise10/viewer/en/viewreport.csp?id=36306204&apsuser=Administrator&apspassword=&apsauthtype=secEnterprise&promptex-CountryStr=”France”&init=actx[/URL]

The difference - in your example you had a datatype after the parameter, thus changed to CountryStr as opposed to Country.

Yes the parameter in the report definately "Country".
The report stored in a folder on Crystal Enterprise 10.
All historical instances removed, all sheduling removed, and parameters set to [Empty].

The link takes the user to a parameter page where he is prompted for "Country" - any ideas?

To note, we do not have "viewrpt.cwr on our system, but we do have view report.csp, and I am therefore using it.

EO
Hertfordshire, England
 
HI,
viewrpt.cwr is not a file, it is a command recognized by the CE system...

Try it with this ( all on one line, of course and adding your password [never leave the Administrator account open]):
Code:
[URL unfurl="true"]http://aflon1cry01/viewrpt.cwr?id=36306204&apsuser=Administrator&apspassword=&apsauthtype=secEnterprise&promptex-CountryStr="France"&init=actx[/URL]

Hope it helps..

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Same thing (prompting for country parameter), but this time I just get a different viewer. I think it is Active X. In some of your previous postings users and ytourself suggest quite long CSP page coding. Is it this layer I am missing?
Have CE10 and BOExi been designed to accept this type of coding, or is it a "fudge" using bespoke CSP/ ASP pages?

EO
Hertfordshire, England
 
Hi,
Glad it worked..

BOE XI will not use .csp pages unless the IIS server is specially configured to do so ( except in very limited corcumstances).
It will use .ASP ( with VBScript or JavaScript) for custom pages developed to provide a user interface layer instead of using BOE's aspx based ones ( like InfoView).

The URL reporting method is in BOE XI ( it was 'sort of' desupported in 9 and 10 ) using their viewrpt.aspx or viewrpt.cwr methods, but we use it ONLY or those users who insist on the ActiveX or Java viewers..BOE's DHTML viewer can be called in an .asp page and makes calling reports much easier:

This page ( and its code) allows for the passing of the needed parameters and then displays the report-( Note:we have created a User account that has View-On-Demand rights to all our public reports and use that in this code..That way , for public reports, this pages can be called directly if desired)..

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 ' PURPOSE - This sample ASP application demonstrates how to view 
'           on demand a report with a multiple value parameter  or parameters
'           
' 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 = "<YOURSERVER>"
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("NumParams")
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
'Dim Qry
'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")
'Qry = Reports.SQLQueryString
'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,dply

'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>

It calls a simple page to actually produce the output:

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
%>

For your example, you would use a URL like:



For security-limited reports, we have a variant of the report_viewer.asp page that reads session variables to get the user/pass needed to access the secured report


Probably more answer than you needed, but when you move to XI, you may find it helpful...



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top