Solved

Prevent Crystal Reports from prompting for unused parameters

Posted on 2014-10-08
15
414 Views
Last Modified: 2014-10-10
Hi,
I have a report which is used by humans on-demand, and is also run by a computer each night (to email it to people).
Humans are presented with a parameter, allowing them to specify a date range.
The computer should use yesterday's date.
Instead of maintaining two separate reports, I am trying to make life easier for myself by a creating a single design which behaves differently depending on which filename it is saved with.

When the report filename includes the string 'IQALERT', the report should use yesterday's date (and should not prompt the user for anything!)
When the report filename does not include the string, the report will prompt for date parameters.

Here is my record selection formula (which is the only place that references the parameter).

	if instr(uppercase(filename),"IQALERT") = 0 then 
		(
			(if hasvalue({?DateRange}) then
				(date({CLOSEDATES.trans_date}) in {?DateRange})
				else true)
		)


		else
		(
			date({CLOSEDATES.trans_date}) = dateadd("d", -1, today)
		)

Open in new window


or to put it into pseudocode:
if <filename does not include 'IQALERT'>
then 
<get date range from parameters>
else
<use yesterday's date>

Open in new window


My problem is that the report still prompts for parameters, even when the filename includes 'IQALERT'
(and therefore the parameter values aren't needed by the record selection formula).

How can I prevent the report from prompting for parameters when they're not needed?

Thanks!
0
Comment
Question by:vistamed
  • 8
  • 4
  • 3
15 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 300 total points
ID: 40368705
I don't believe you can.   As far as I know if a parameter is used in the report even in the manner you are using it, it will be prompted for.

The filter is not evaluated until you click RUN or SCHEDULE for the report.

Since your situation is for use when you schedule the report, what is the issue.  You normally will schedule the report once and it will run until you need to change other parameters.

You seem to have solved your problem with the method you are using.   All you need to do is just ignore the prompt.  With your method you are still maintaining 2 versions of the report.  The only difference is you can make the changes once then save the report twice.

mlmcc
0
 

Author Comment

by:vistamed
ID: 40368767
Hi Mlmcc,
The trouble is that the scheduled report is generated by our ERP system and it has no capability of handling things like parameter prompts. It would simply say that there was a error running the report. So I have to make certain that the version of the report it is presented with, will never ask for parameters.

If what I described can't be made to work, I'll be stuck with maintaining two very similar reports. Every time a revision is made, I will need to save one version with all the parameters etc., then redesign it to remove all the prompts, replace the record selection formula etc. It would have been so nice to eliminate the need for all that redesigning, and have it behave differently depending on the filename. If it wasn't for the damn prompt, it would have worked perfectly too! :(

I'll leave the question open for a day or two, just in case anyone comes up with a stroke of genius.

Thank you!
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 40368858
If you give a parameter a default value does the ERP system handle it?

mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 40368861
What version of Crystal are you using?

mlmcc
0
 
LVL 18

Assisted Solution

by:vasto
vasto earned 200 total points
ID: 40369087
I don't know what is your current environment, but here is how it should work : Your software should be able to calculate the default values for the parameters and use them when the report is run. When the report is started manually the default value will be calculated and shown to the user and he/she will be able to change it. When the report is scheduled obviously nobody will change the calculated values and they will be used. The main thing here is that the value will be calculated outside the report - in the software , which is running the report. This will allow you for example to switch the period to previous day, week, month, quarter and year without changing the report. As far as I understand your current software for manual reporting is OK. I would suggest you to check the community edition of R-Tag: http://www.r-tag.com/Pages/CommunityEdition.aspx
This is a commercial product , but it is free if you don't need tech support. It will allow you to schedule reports and to define the default values, which will be used, so you don't need to change your report.
0
 

Author Comment

by:vistamed
ID: 40370175
Hi,

mlmcc, the ERP system still throws an error even when I set a default value for the parameter. It says "Reports that prompt for parameters are not supported by this application".
The runtime engine that generates the reports on the server is
SAP Crystal Reports runtime engine for .NET Framework 4, version 13.0.4.705.

Vasto, thanks for the suggestion but to move all the ERP system's scheduled reports out to an external program would be a far bigger nightmare than maintaining two similar reports! I'll just accept that what I'm asking for can't be done. Thanks to you both for your help!
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 40370633
Here is an idea that might make the 2 files easier to maintain.

Create a formula
Name - Selector
'ALL'

Change your selection formula to

If {@Selector}  = 'ALL' then
     TRUE
Else
    {DateField} >= Today - 1

mlmcc
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 18

Expert Comment

by:vasto
ID: 40371273
You do not need to move all reports. You need to move just one. I agree that having 2 applications will be not the best option , but having 2 reports is worse because you might have differences in the result if the reports are not synchronized. BTW there should be a way to set the parameters values for the scheduled reports . which ERP are you using ?
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 40371366
Thererror clearly indicates the application doesn't support parameters.

mlmcc
0
 
LVL 18

Expert Comment

by:vasto
ID: 40371383
Then, how they will be able to run any report if a parameter is required ? I guess there should be a way through the ERP to set the parameter values
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 40371419
I tend to agree but when I first wrote a viewing program, parameters caused problems.  In some cases I handled them in my application and created the selection formula in code and passed it in.  I needed to do that since CR8 didn't support optional parameters and I didn't want the users to have to enter ALL or a default value.  They wanted to be able to filter the data on one or more of about 15 fields so I built a parameter selection screen and when they clicked OK I checked which ones had values and built the selection formula from that.

That also gave me full control over the parameters and I had dynamic parameters and cascading parameters long before Crystal added the feature.  It also helped us implement row level security since I could limit the values in a list to those a particular user was allowed to see based on the department he was in, who they supervised, etc.

mlmcc
0
 
LVL 18

Expert Comment

by:vasto
ID: 40371460
This will handle the local filtering for small amount of data or for a record selection formula which could be passed directly to the server but will not work with stored procedures. And the report will be restricted to work with just one application. Apparently vistamed is able to add an external report to his ERP , which means that parameters should be supported ( or at least I would expect to have support for parameters). Anyway, I was just curious which ERP is this.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 40371649
It was a very specific application highly customized for a single client.  It automated their workflow eliminating paper by passing the "paper" through the intranet.

mlmcc
0
 

Author Comment

by:vistamed
ID: 40372411
Hi folks,

The ERP system is called Enterprise IQ, by a company called IQMS. The user interface (the program the punters use) has no problems with reports that include parameters- they're popped up for the user to fill in. It's only the scheduler on the server that doesn't like parameters with reports.
Anyways, please don't worry about it - I've added a hidden section at the bottom of the report design to remind myself of which changes need to be made  to convert the on-demand report to the scheduler version (e.g. edit the record selection formula, tweak a couple of other formulas etc.) It's not that big a deal - I was just looking for a nice lazy option which would save me having to make those couple of edits!
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 40372956
WHat about my idea where you have a formula that you change then test.

Record selection formula becomes

If {IsScheduledVersion} = True then
(
   Scheduled Filter
)
Else
(
   OnDemand Filter
)


Similarly for other formulas

In that way the change is made to a single formula not to several

mlmcc
mlmcc
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now