Wednesday, March 21, 2012

Multiple Where Clause on One Report

Hello People, Please help. I have a basic report with a parameter in the 'Where" clause called (@.Stat) from the statement below:

" WHERE contractinfo.termdate >= GETDATE()
AND provider.status= 'Active' AND provider.credentialstatus = (@.Stat)"

This variable has one of two values: 'A' or 'B' that the user selects, how do I set it up so that if user selects say 'A' then the Where clause would go to one set of constraints ie

"WHERE contract.description NOT LIKE 'NON%' "

But if the user selects 'B' then the Where clause would go to a different set of constraint ie

"WHERE contract.description LIKE 'NON%' "

Thanks

You might be able to change your WHERE clause from this:

Code Snippet

WHERE contractinfo.termdate >= GETDATE()

AND provider.status= 'Active' AND provider.credentialstatus = (@.Stat)

to this:

Code Snippet

WHERE contractinfo.termdate >= GETDATE()

AND provider.status= 'Active'

AND ( @.stat = 'A' AND contact.description not like 'NON%' OR

@.stat = 'B' AND contact.description like 'NON%'

)

|||Thanks for the help Kent that worked great, the only thing I did different for my report was leaving the original (@.Stat) parameter in also otherwise it would not have filtered it by the "A or B" condition and then adding your script suggestion.. Thanks again

No comments:

Post a Comment