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

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?
Member_2_6499057Senior Consultant - ITAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike McCrackenCommented:
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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Member_2_6499057Senior Consultant - ITAuthor Commented:
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..
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.