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

Selection Formula Error

Status
Not open for further replies.

elf1

Technical User
Jun 6, 2001
43
US
Greetings,

I am making a modification to an existing report, and having an issue with the following selection formula:

({DeductionCode} in ["K", "KA", "KM"] or
{EarningCode} in ["13", "12", "11", "01"]) and
{CheckDate} = {?Check Date}

When I generate data is only returning the deduction codes within the given date range. If I switch the deductioncode and EarningCode selection around, it is only returning the earning code.

Can anyone tell what the issue with my formula is?

Thanks!
Rick

 
Hi,
Using ORs and ANDs can get confusing use Parens to clearly separate the sections and to enclose the entire criteria, try:
Code:
(  [COLOR=green]// Criteria as a whole[/color]
  ( [COLOR=green]// Check to see if [u]either [/u]of these is true [/color]
   {DeductionCode} in ["K", "KA", "KM"] or 
   {EarningCode} in ["13", "12", "11", "01"]
  ) [COLOR=green]// Finished checking on those 2 conditions[/color]

 and  [COLOR=green]// In Addition, check this [/color]
  (
    {CheckDate} = {?Check Date}

  ) [COLOR=green]// OK checked the Date [/color]


) [COLOR=green]// Now I have tried all the conditions[/color]

Should return any record with the supplied Date and where
either the EarningCode is in the list OR the Deduction code is in its list.
May be Overkill but seems clearer..


[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Turkbear,

Thanks for the tip. I added more parens and comments to make sure I had everything correct, and I am still not receiving the data from the second portion of the OR.

Here is my current statement:
( //start selection
( //start OR statement
{EarningCode} in ["01", "11", "12", "13"] or
{DeductionCode} in ["K", "KA", "KM"]
) // end OR
and
( // AND statement
{CheckDate} = {?Check Date}
) //end AND
) //end selection


Thanks!
Rick
 
Hi,
Is there the possibility of some of the
{DeductionCode} or {EarningCode} being NULL?

In Crystal you must handle the NULL value possibility first or the formula will likely not produce what you expect.





[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Can you put in words what you are trying to return? Do you want:

1- these earning codes within the date range and these deduction codes within the date range
2-these earning codes regardless of date range and these deduction codes within the date range
3-these deduction codes regardless of date range and these earnings codes within the date range

-LB

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top