Crystal Reports selecting providers having no orders between date one and date two but having orders outside of those two dates.

Member_2_6499057 used Ask the Experts™
I am using crystal reports XI. The problem that I have is with a select statement....I think. Anyway, I am trying to select all PROVIDERS from the ORDERS table who have not received a specific order from DATE1 to DATE2. Seems simple...however, when I just go into the select wizard and tell it to show me all providers not having an order between DATE1 and DATE2 it shows me all "records" not having an order date between DATE1 and DATE2. So, I really need to formulate a list of providers and then have crystal run through each one and see if his ID has had an order in between those dates and if so then do not show that provider's records in the report and if no order between those dates then list the provider and all other dates he/she did receive that order. Make sense?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Consultant
Most Valuable Expert 2011
Top Expert 2013
You can do this in 2 ways.

Are you doing summaries in the report?
If not you can select all records for the report then use the group selection to hide the ones with orders in the period

Create a formula
Name - HasOrderInRange
If {OrderDate} >= {?StartDate} AND {OrderDate} <= {?EndDate} then

Open in new window

Add a group on the Provider Field
Use this as the selection formula in the group select expert

Sum({@HasOrderInRange}, {ProviderField}) = 0

Open in new window

Another way to do this is with a command as the data source

Something like
Select Provider, OrderDate, ...
NOT (Provider IN (Select Provider From OrderTable Where OrderDate >= ?StartDate AND OrderDate <= ?EndDate)

Open in new window

Member_2_6499057Senior Consultant - IT


You saved me just in time. I cannot tell you how much you have helped me by answering this question!! WOW, mlmcc...I may get to keep my job because of you..

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial