Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Parameter - Return multiple Values Post Reply Post New Topic
Author Message
namitanamburi
Newbie
Newbie


Joined: 26 Mar 2009
Online Status: Offline
Posts: 39
Quote namitanamburi Replybullet Topic: Parameter - Return multiple Values
     Posted: 14 Jan 2011 at 9:35am
Hello,


I have written a query in command line like

select * from employee_table where Occupation in ['{?Occup}']

Here is the Employee_table





    Eid Name Occupation



1 John Manager
2 Pam Clerk
3 Julie Manager
4 Jacob Clerk
5 Suzie Assistant








So now Manager falls int Category 'Senior' and Everything else is 'Junior' like the clerk and Assistant.


select * from employee_table where Occupation in [ '{?Occup}']


I added the following values to default list of Parameter {?Occup}

Manager

Clerk, Assistance.


So The prompt would have a list of values

Manager
Clerk, Assistant

This would work if user selects Manager from the list and executes Because

select * from employee_table where Occupation in [ 'Manager']

The above query would return results

But doesnot work for 'Clerk, Assistant' , reason being

select * from employee_table where Occupation in [ 'Clerk, Assistant']

This wouldnot return any values.

Is there a possibility for

select * from employee_table where Occupation in [ 'Clerk', 'Assistant'];


If I created a report by dragging the tables , I would have written a formula like

If {?Occup} = 'Junior'
then  Occupation in [ 'Clerk, Assistant']
else if
If {?Occup} = 'Senior'
then  Occupation  = 'Manager
else 'True'

Then in the select expert I would have selected the formula to be True.


Just because I wrote the SQL query in command Prompt this method seems not to work.

Is there any way my requirement being met?

I tried decode

select * from employee_table where Occupation in [   (DECODE('{?Occup}','Junior',('Clerk, Assistant'),'{?Occup}')]

Doesnot work as decode doesnot return multiple values.

Please advise.

Thanks
Nammu





IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 17 Jan 2011 at 4:57am
I believe it is not possible to use Crystal fields in the Command feature.

Then again, that's mainly because I haven't found a way to do so.

I've been looking into SQL expressions and found some threads that may be interesting

http://www.crystalreportsbook.com/Forum/forum_posts.asp?TID=991
http://www.crystalreportsbook.com/Forum/forum_posts.asp?TID=11756

Edited by Keikoku - 17 Jan 2011 at 5:04am
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum