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

Crystal XI - Record Selection Formula - Not include fields 1

Status
Not open for further replies.

pndMaster

IS-IT--Management
Mar 6, 2013
20
US
Hello,

I have below record selection criteria

If {?Status}='ALL' Then True Else {Command.Status}={?Status}
and
{Command.DateService}>={?StartDate}
and
{Command.DateService}<={?EndDate}

My goal is when user selects ALL or do not select any value for Status parameter i do not want to include it part of the record selection criteria. I thought above will work but when i look at the query the where clause has
Command.Status=N'' when {?Status}='ALL' or ISNULL({?Status})
above giving me incorrect data because it is returning records with null status but i would like to return records with in the date range regardless of status criteria.
how could i achieve it. I appreciate guidance.
Regards
Harris
 
I think you need some parentheses. Try this:

({?Status}='ALL' or {Command.Status}={?Status})
and
{Command.DateService}>={?StartDate}
and
{Command.DateService}<={?EndDate}
 
pndMaster, over the past 2 1/2 years you have started 9 threads where various members have posted replies. Yet you have not replied in any way: good, bad or indifferent.

If you browsed any of the forums here at Tek-Tips, you'll notice that the original posters' replies are vital to other members, for identifying what answere were Great Posts. You, no doubt, have also seen the little purple stars. This is all part of what makes Tek-Tips such a great site.

So I hope you'll help us make your threads more meaningful with appropriate replies

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
Hello,

If you are adding OR and removing IF then how does it work, because then we are saying use ALL or what ever the value the user selected for status. What i am looking for is when user selected ALL or null then status should not be part of the criteria.

({?Status}='ALL' or {Command.Status}={?Status})
and
{Command.DateService}>={?StartDate}
and
{Command.DateService}<={?EndDate}

Regards
 
So is {?Status} a optional prompt? If so, you may need to use the hasvalue function. Probably like this.

(if hasvalue({?Status}) then
if {?Status} = 'ALL' then true
else {Command.Status}={?Status}
else true)
and
{Command.DateService}>={?StartDate}
and
{Command.DateService}<={?EndDate}


You might want to put the first part into a formula and then use the formula in the selection criteria, I will read a little easier.

 
If i put the first part in the formula then what would the formula evaluate if {?Status} does not have value?

(if hasvalue({?Status}) then
if {?Status} = 'ALL' then true
else {Command.Status}={?Status}
else true)

I am tryi
 

I am trying to understand what does it mean when we say else true? because if it evaluates to True what would crystal replace with if it is joining other statements with true?

in below case if the first part evaluates to True then it is combined with and with date range criteria.

i would like it to not consider the {?status} parameter or field part of the selection criteria
 
I thought you wanted to filter based on the {?Status} if someone entered a value for {?Status}. The way I saw it stated. If no value or the value of All is entered for status, then return all values of {Command.Status} otherwise filter by the {?Status} value(not sure how the date range works in to this).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top