cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal report logic

Former Member
0 Kudos


Good Morning,

I am creating a crystal report using sql server.  I created three note parameters with the idea that a user can search on the note parameter and the note1 parameter or the note parameter or note 2 parameter.  The below formula will only allow me to use the note parameter or note 2 parameter, but not the first part note and note 1.

Thanks

 

 

(not HasValue({?Notes}) OR {IB_NOTES.NOTES} like "*"+{?Notes}+"*") and

(not HasValue({?Notes1}) OR {IB_NOTES.NOTES} like "*"+{?Notes1}+"*")

 

or

(not HasValue({?Notes}) OR {IB_NOTES.NOTES} like "*"+{?Notes}+"*") or

(not HasValue({?Note 2}) OR {IB_NOTES.NOTES} like "*"+{?Note 2}+"*")

 

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

 

Thanks Abhilash. Although the or part works with this logic  and the part does not. Can you tweak this formula to have the whole logic work?

abhilash_kumar
Active Contributor
0 Kudos

I'm not too sure how the 'and' part will work. It's like saying:

Crystal Reports = Crystal Reports AND

Crystal Reports = SAP


-Abhilash

former_member292966
Active Contributor
0 Kudos

Hi Natalia,

If

(not HasValue({?Notes}) OR {IB_NOTES.NOTES} like "*"+{?Notes}+"*")

is true then the Or takes precedence over the And.  So Notes2 will always be evaluated. 

Try a nested if like: 

If (not HasValue({?Notes}) OR {IB_NOTES.NOTES} like "*"+{?Notes}+"*") And

     (    

     (not HasValue({?Notes1}) OR {IB_NOTES.NOTES} like "*"+{?Notes1}+"*") Or

     (not HasValue({?Note 2}) OR {IB_NOTES.NOTES} like "*"+{?Note 2}+"*")

     )


This way the Notes are evaluated once then it checks the Notes1 or Notes2. 


Hope this helps,

Brian

Answers (1)

Answers (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Natalia,

Try:

(

(not HasValue({?Notes}) OR {IB_NOTES.NOTES} like "*"+{?Notes}+"*") and

(not HasValue({?Notes1}) OR {IB_NOTES.NOTES} like "*"+{?Notes1}+"*")

)

OR

(

(not HasValue({?Notes}) OR {IB_NOTES.NOTES} like "*"+{?Notes}+"*") or

(not HasValue({?Note 2}) OR {IB_NOTES.NOTES} like "*"+{?Note 2}+"*")

)

-Abhilash