Parameter (sometimes optional & smtimes mandatory (1 Viewer)

namitanamburi

New member
Local time
Today, 10:33
Joined
Jan 13, 2011
Messages
3
Hello,

I created a report with the query below.

Select * from employee_table where employee_name = {?Ename}.

People may choose to enter a name or may want to see all the employee names.

So I created a default called 'All' for the parameter Ename and created a formula called e_formula stating that

if {?Ename} in {employee_table.Ename} then
{employee_table.Employee_name} else if
{?Ename} = 'All'
then True.

In the select expert set the condition to True.

This works fine , user gets a prompt to enter 'All' for all users else enter 'Employee name' they wish to find.

Now the users feel its too much to enter 'All', cant they just leave it blank which should default to 'All' and proceed to execute the report?

Is there any way to do this?

User will enter Employee name if he wants to find a specific user, else will just ignore that parameter and click on Run to execute the report.

Iam using crystal reports version 10.

Please advise.
Nammu
 

vbaInet

AWF VIP
Local time
Today, 18:33
Joined
Jan 22, 2010
Messages
26,374
Code:
IIF(Len([Enter Employee Name] & "") = 0, "All", [Enter Employee Name])
 

boblarson

Smeghead
Local time
Today, 10:33
Joined
Jan 12, 2001
Messages
32,059
Code:
IIF(Len([Enter Employee Name] & "") = 0, "All", [Enter Employee Name])

That doesn't work with Crystal Reports. :)
 

vbaInet

AWF VIP
Local time
Today, 18:33
Joined
Jan 22, 2010
Messages
26,374
That doesn't work with Crystal Reports. :)
Haha!:) I didn't even see where the OP mentioned Crystal Reports. I was wondering why the OP was using curly braces, so I thought he/she was just writing aircode :p

I don't use Crystal, although I play with it now and again.
 

boblarson

Smeghead
Local time
Today, 10:33
Joined
Jan 12, 2001
Messages
32,059
Which version of Crystal Reports are you using Nammu? It is fairly easy to use the built-in dynamic parameters (instead of modifying your query) IF you have Crystal Reports XI or above.

It's been almost 5 years since I have gotten to work with CR, so I'm remembering less and less each day.
 

kevlray

Registered User.
Local time
Today, 10:33
Joined
Apr 5, 2010
Messages
1,046
Do a check to see if the parameter is null or empty (i.e., if (isnull({?Ename}) or {?Ename} ="") then true
else
{?Ename} = {employee_table.Employee_name})

Put the formula in the record selection and have it check for 'is True'. I worked on a test database for me in XI.
 

namitanamburi

New member
Local time
Today, 10:33
Joined
Jan 13, 2011
Messages
3
Thank you for the reply.

We are using Java in our application and have configured a crystal viewer version 12 in the application to execute and view the report.

With the method that mentioned, I generated a rpt file.

But when deployed, user cannot leave any of the prompts blanks in the viewer, he needs to atleast click in the box and then hit enter to view report. When I say box I mean the place where user enters the Parameter value.

Please advise.
Nammu
 

namitanamburi

New member
Local time
Today, 10:33
Joined
Jan 13, 2011
Messages
3
Bob,


As I mentioned in our earlier post, "With the method that mentioned, I generated a rpt file"

It works fine in the crystal client software, but when deployed, parameter box becomes mandatory. You have to click on the box atleast if you donot want to enter any value.

Thank You
Swathi
 

boblarson

Smeghead
Local time
Today, 10:33
Joined
Jan 12, 2001
Messages
32,059
Bob,


As I mentioned in our earlier post, "With the method that mentioned, I generated a rpt file"
With WHAT method did you create the rpt file? With Java? If so, that's your problem. You would need to figure out how to make the change that kevlray told you to do, via the code. Otherwise you will be stuck.
It works fine in the crystal client software, but when deployed, parameter box becomes mandatory. You have to click on the box atleast if you donot want to enter any value.
Yep, and until you program in that other change, it is going to act that way.
 

Users who are viewing this thread

Top Bottom