Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Setting parameter value at runtime Post Reply Post New Topic
Author Message
pritamdas24
Newbie
Newbie
Avatar

Joined: 30 Jul 2007
Location: India
Online Status: Offline
Posts: 24
Quote pritamdas24 Replybullet Topic: Setting parameter value at runtime
    Posted: 06 Aug 2007 at 7:27am
Hi
 
i have a table tab1
 
emp id                emp name                    salary
 
1                             xyyyx                        1000
2                             sadad                        1000
3                             qwert                        2000
 
i have two parameters in CR XI namely  p_empid n p_salary
i can choose both  emp_id and salary  or i can choose either salary  or empid while filtring.
then how can i write  the same in record selection formula
Regards
Pritam
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 06 Aug 2007 at 10:21am
Since you are using parameters, I assume you'll enter a zero for the parameter to be ignored? If so, I would do something like the following:
({empfield}=p_empid and {salaryfield}=p_salary) OR
(p_empid=0 and {salaryfield}=p_salary) OR
({empfield}=p_empid and p_salary=0))

Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
pritamdas24
Newbie
Newbie
Avatar

Joined: 30 Jul 2007
Location: India
Online Status: Offline
Posts: 24
Quote pritamdas24 Replybullet Posted: 07 Aug 2007 at 7:56am
Originally posted by BrianBischof

Since you are using parameters, I assume you'll enter a zero for the parameter to be ignored? If so, I would do something like the following:
({empfield}=p_empid and {salaryfield}=p_salary) OR
(p_empid=0 and {salaryfield}=p_salary) OR
({empfield}=p_empid and p_salary=0))

 
 
Hi Brian
Thanks for the help
but what if i am using String or date parameter
Regards
Pritam
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 07 Aug 2007 at 9:00am
It doesn't matter what you use. You have to identify how the user will specify that a parameter isn't going to be used. In a string I assume that is the empty string. For a date, I don't know.  But then compare that field to the 'no-parameter' value. Here, I changed the second line to compare it to an empty string:

(p_empid='' and {salaryfield}=p_salary)....


Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.