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

Crystal syntax wrong 1

Status
Not open for further replies.

Eprice

Technical User
May 6, 2003
209
US
Hi,
I am new with crystal reports and don't have any idea how to write the following criteria. I do know that I am not getting the correct results and maybe it is how the report is set up and not the formula I am using which is:

{joblog_.FREQUENCY} = "MONTHLY" and
{Joblog_.DISTRIBUTION} <> "IS" and
(
IsNull({joblog_.FREQUENCY NOTES}) or
trim({joblog_.FREQUENCY NOTES}) = "" or
INSTR({Joblog_.FREQUENCY DETAIL}, "Apr")= 1 or
{joblog_.FREQUENCY NOTES} ="REQUEST"
) or
{joblog_.FREQUENCY} = "SPECIAL" and
{Joblog_.DISTRIBUTION} <> "IS" and
(
INSTR({Joblog_.FREQUENCY DETAIL}, "Apr")= 1 or
{joblog_.FREQUENCY NOTES} ="REQUEST"
)

What I am looking for is:

Distribution cannot be 'IS' ever

If Frequency = 'Monthly' then
Freqency notes can either be empty or "Request" or
Frequency Detail can have 'Apr' somewhere in the string.

or

If Frequency = 'Special' then
Frequency Notes can be 'Request' or
Frequency Detail can be 'Apr" somewhere in the string.

Frequency Detail is a text field that can hold several different months. Examples are:
Jan, Feb, Mar, Apr, Oct, Dec
Dec
Apr, Jun, Jul

All other fields are text.

I think it is the order I wrote this that is wrong but, as I said, do not know much about Crystal Reports. Please help
Lisa


 
[red]([/red]
{joblog_.FREQUENCY} = "MONTHLY" and
{Joblog_.DISTRIBUTION} <> "IS" and
(
IsNull({joblog_.FREQUENCY NOTES}) or
trim({joblog_.FREQUENCY NOTES}) = "" or
INSTR({Joblog_.FREQUENCY DETAIL}, "Apr") [red]<>0[/red] or
{joblog_.FREQUENCY NOTES} ="REQUEST"
)
[red])[/red]
or
[red]([/red]
{joblog_.FREQUENCY} = "SPECIAL" and
{Joblog_.DISTRIBUTION} <> "IS" and
(
INSTR({Joblog_.FREQUENCY DETAIL}, "Apr") [red]<>0[/red] or
{joblog_.FREQUENCY NOTES} ="REQUEST"
)
[red])[/red]

Note the parens which are not optional. Note also that instr() returns the position of the first character in the string, so 1 would mean that the string must start with "Apr". If the value is not anywhere in the string, the function will return 0.

-LB
 
Wow,
That was exactly what I needed. Thank you!
Lisa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top