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

Parameters Input Page

Status
Not open for further replies.

rexii

Technical User
Jul 16, 2003
3
AU
Hi all,

Umm I have this request to build a page within Crystal Enterprise 9 professional that intercepts the user after selecting schedule a report then the parameters screen. What they want is a page that allows a user to input many filters. A where statement has to be constructed through this, basically providing the filters to the report and running the report based on the inputed criteria.

Constraints:
They don't want to use the current parameters scree. the current parameters are to controlled Ie. they may want a person to put in <> rather than = or one of...etc.

Has anyone done this before, if so can you guide me in the right direction or maybe give me an example page of code that you have done.

Regards,

Kent Lawrence
kentl@alphabus.com.au
 

I have been playing around with ePortfolio for the past few days and I would like to be able to modify the parameter page also, or if it is not possible I would like to pass the parameter values at run time into the report if it is viewed on demand. I've used the selection formula to show and filter rows dynamically, but it is extra strain on the server to build the report for all possible values and then filter through them at run time.

Anyone with ideas or solutions out there?

 
Hi,
In the most basic case,
you can pass the parameters as part of the URL that is used to run the report -
Create a parameter ( say, item_cd ) and use it in your records selection formula:

item_id = {?item_cd}

When calling the report to can use:
&promptex-item_cd=25
as part of the url to just get those items..

You can,of course make it much more complex than that by using combinnations of csp, asp and javascript to create a page the provides your user(s) with drop-down lists from which to choose parameters, process their choices and pass the results to
CE ---

Here is a snippet of a 'generic' JavaScript function to run a report once it has been called with the proper parameters ( in this case a boolean and a text sting and the report#)

Code:
<SCRIPT Language=&quot;JavaScript&quot; >

function RunRpt(pr1,pr2,m){
amper = &quot;<%=Server.UrlEncode(&quot;&&quot;) %>&quot;
var progid=&quot;CrystalEnterprise.Report&quot;
 var pstr1 = amper + &quot;promptex-currentdelinquent=&quot; + pr1
 var pstr2 = amper + &quot;promptex-searchCO=&quot; + pr2
 var pstr = pstr1 + pstr2
  windowprops = &quot;fullscreen=no,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes&quot;;
 reportWindow = window.open(&quot;empviewer.csp?qid=&quot; + pstr + &quot;&progid=&quot; + progid + &quot;&rid=&quot; + m,&quot;rptWindow&quot;,windowprops);
}

Lots of assumptions here, so beware of using it as written..
Hope it helps..
[profile]

 
I am using CE 9 and the dynamic HTML viewer.

The suggestion of using &promptex-value=test seems not to work for me, it works as if it never existed.

Here's my url string:
viewreport.csp?init=connect&id=486&promptex-UserName=&quot;kyle&quot;
 
Turkbear,

What's empviewer.csp ... is that your report viewer window? I'm trying to figure out how all of this works and would love to see that as an example. Would you be permitted/willing to send it to me so I could study it? My email is denise.duggan@dbpr.state.fl.us if you are. Thanks.

 
Hi,
empviewer.csp is a Crystal-provided ( in the samples or tutorial, I forget where I found it)page that, after some processing, calls viewrpt.cwr:
The following is a simple version of it that expects to have the report number passed to it as a querystyring called 'rid'. By adding additional
Request.QueryString.Item(&quot;whatever&quot;)s you can pass the parameters needed for the report ( see qid= in my original post )..

Code:
<html>
<head>

<% @language=JavaScript codepage=65001%>
<!-- #include file=&quot;setcodepage.csp&quot; -->
<!-- #include file=&quot;helper_js.csp&quot; -->

<script language=Javascript>
function init()
{
	document.forms[&quot;redirForm&quot;].submit();
}
</script>
</head>

<body onload=init()>

<%
var action, tokenName;
var progid = Request.QueryString.Item(&quot;progid&quot;);

if(progid = &quot;CrystalEnterprise.Report&quot; )

{
                     
        action = &quot;viewrpt.cwr?id=&quot; + Request.QueryString.Item(&quot;rid&quot;) + &quot;&init=actx&quot; + Server.URLEncode(&quot;:connect&quot;);
        tokenName = &quot;apstoken&quot;;
	
	
        
}
else
{
	action = &quot;infoobject.cwr?id=&quot; +  Request.QueryString.Item(&quot;id&quot;) + &quot;&action=0&quot;;
	tokenName = &quot;WCSLOGONTOKEN&quot;;
}





Response.Write(&quot;<form name='redirForm' method='post' action='&quot; + action + &quot;'>\n&quot;);
Response.Write(&quot;<input type='hidden' name='&quot; + tokenName + &quot;' value=\&quot;&quot; + Server.HTMLEncode(GetCookie(&quot;logontoken&quot;)) + &quot;\&quot;>\n&quot;);
Response.Write(&quot;</form>\n&quot;);
%>

</body>
</html>

Hope it helps..We call almost all of our reports ( over 200 so far ) with this method ( or a variant of it) - our users do not want to use ePortfolio ( they would want it so customized, that it became easier to create custom pages instead)..

[profile]


 
Do I need to do anything special in the report in order to use the promptex-paramname parameter?
 
Hi,
In CE8.5 ( Maybe as early as 8) and above it is a preferred alternative to the older form, prompt#

It is much more flexible ( as an example,the ability to refer to a parameter by name allows for much more reuse of code; the same function can be used to call many reports by simply changing the text that is sent as a parameter name/value string and changing the report number. For this reason I require all report designers who want to publish to our CE web to use meaningful parameter names. )
...Read up on its use in the docs, it has many more advantages....

[profile]
 
Ok, my problem was that the name of the parameter started with '@', since it was a sp param, i needed to add a %40 in front of the name and pass it into the uri.
 
Hi,
Yep, the 'oddities' of what can be passed in an URL are sometimes baffling..
When in doubt, I try to use javascript variables to hold url encoded
versons of the 'odd' characters before I call the report:
Code:
amper = &quot;<%=Server.UrlEncode(&quot;&&quot;) %>&quot;
atsign = &quot;<%=Server.UrlEncode(&quot;@&quot;) %>&quot;


Seems to work fine...

[profile]
 
Is it possible to pass a parameter to crystal viewer (CrystalReports.CrystalReportViewer object which is used in viewreport.csp page in ePortfolio)?
 
dky1e,

I am also trying to figure out how to pass parameters using CrystalEnterprise.CrystalReportViewer. Have you had any success in it? If so, what about passing multiple values to the same parameter ??

 
If you are experienced with CSP (or ASP), you might want to play around with the code in schedule.csp (part of ePortfolio). I built a pretty sophisticated parameter window for our custom application and used the Parameters tab from schedule.csp as a base.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top