Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Need to show results for specific date range Post Reply Post New Topic
Page  of 2 Next >>
Author Message
chonchos
Newbie
Newbie
Avatar

Joined: 02 May 2013
Location: United States
Online Status: Offline
Posts: 9
Quote chonchos Replybullet Topic: Need to show results for specific date range
     Posted: 03 May 2013 at 4:41am
Long time lurker, first time poster.

I have an issue that I believe I may be over thinking. It seems like it should be so simple.

Here's the deal.

We have a cabinet of customer files that is packed to the brim. We want to thin it out a bit. So I wanted to utilize Crystal Reports to determine which accounts are no longer active.

So in my report I have the Company Names and the Sales Order dates. I want it to show any company that hasn't had a sale in the past 5 years and also filter out any companies that ordered before 2006 (we have companies in the database all the way back to the 90's but didn't start keeping files until 2006).

The problem I'm having is that when I use selection criteria on the date range it will only show dates between 2006-2008... but I want it to hide the company name if they have a sales order dated beyond 2008.

I feel like I'm over thinking this and it isn't as hard as I'm making it out to be. But I've been trying to make it work for a week and googled to no end.

If this isn't clear enough I'll happily provide more information or attempt at clarifying further.

Thank you in advance for your help. :)
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 May 2013 at 5:39am
If the data doesn't go back before 2006, when you started keeping records, then you won't be able to find it (it's not there).

If the data exists from say the 90's, but was only entered in 2006, then perhaps you are looking at the wrong date.

HTH
IP IP Logged
chonchos
Newbie
Newbie
Avatar

Joined: 02 May 2013
Location: United States
Online Status: Offline
Posts: 9
Quote chonchos Replybullet Posted: 03 May 2013 at 5:47am
I should have been more specific.

The data goes into the 90's. The HARD files in the cabinet only go back to 2006.

The reason this is relevant: we have over 13,000 customers/companies listed in our database. So if I left it open ended and said I wanted to list any and all companies that did business before 2008 (but not after) I would have an enormous list.

And probably 3/4 or more of that list wouldn't be of use because they don't have hard files in the cabinet that need to be pulled out anyway. Since we didn't start keeping hard files until 2006.

Hope that makes a little more sense.

:)
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 May 2013 at 5:54am
ok, so the date range is fine, since those are the hard records you want to purge, 2006-2008, but it sounds like some of the companies have placed an order in the last 5 years and are still showing up the list to purge.

so wouldn't you want to select companies that haven't ordered in the last five years AND have ordered since 2006, since these are the actual hard copies you are trying to delete?

HTH
IP IP Logged
chonchos
Newbie
Newbie
Avatar

Joined: 02 May 2013
Location: United States
Online Status: Offline
Posts: 9
Quote chonchos Replybullet Posted: 03 May 2013 at 5:58am
Here is an example of what I'm getting..

COMPANY NAME            S.O. DATE

ABC COMPANY             1/2/2006
                            5/5/2008

ALPHA COM               2/2/2006
                             1/2/2007
                     
BETA COMP               1/1/2006
                             1/1/2007
                            1/1/2008


The problem is that ABC company made a sale in 2011.
And Beta comp made a sale in 2013.

Since those companies have made sales within the last five years I do not want them to show up. At all. I only want to see companies that made sales between 2006 and 2008. Nothing before nothing after.

I don't seem to have a problem with the years before 2006 with this configuration.

Edited by chonchos - 03 May 2013 at 5:59am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 May 2013 at 6:05am
so something in the select criteria like:
MAX({table.orderDate}) < #5/3/2008#
AND MIN({table.orderDate}) >= #1/1/2006#

of course you would want to group by the customer so that your data is correct.

HTH
IP IP Logged
chonchos
Newbie
Newbie
Avatar

Joined: 02 May 2013
Location: United States
Online Status: Offline
Posts: 9
Quote chonchos Replybullet Posted: 03 May 2013 at 6:19am
I tried it out.

MAX ({SO_DETAIL.ENTRY_DATE}) < #5/3/2008#
AND MIN ({SO_DETAIL.ENTRY_DATE}) >= #1/1/2006#

It says "The remaining text does not appear to be part of the formula".

I tried it with and without the pound signs.

I placed it in the Select Expert under SO_Detail.Entry_date as a formula.

What am I missing?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 May 2013 at 6:33am
I'll be honest, I am not very expert at the Select Expert, as I mostly deal with stored procedures.

I believe that the error text can be gotten around with something like:
DATE(2008,5,3) or CDATE()...they are the same according to CR Help.

HTH
IP IP Logged
chonchos
Newbie
Newbie
Avatar

Joined: 02 May 2013
Location: United States
Online Status: Offline
Posts: 9
Quote chonchos Replybullet Posted: 03 May 2013 at 9:10am
I also tried the date (2006,00,etc) but did not try CDATE.

I'll try CDATE and report back. Hopefully someone else will be able to provide an alternate solution.

Thank you for your help so far.
IP IP Logged
chonchos
Newbie
Newbie
Avatar

Joined: 02 May 2013
Location: United States
Online Status: Offline
Posts: 9
Quote chonchos Replybullet Posted: 03 May 2013 at 9:28am
CDATE did not work.

However, I did figure out that "MAX/MIN" need to be spelled out to be recognized as functions.

Also, I used this

"MAXIMUM ({SO_DETAIL.ENTRY_DATE}) < DATETIME (2008, 04, 30, 00, 00, 00)
AND MINIMUM ({SO_DETAIL.ENTRY_DATE}) >= DATETIME (2006, 01, 01, 00, 00, 00)"

and feel a little closer because now I'm getting this error

"This function cannot be used because it must be evaluated later."

I'll keep playing with this on and off today and hope to get somewhere. Any other help is appreciated!
IP IP Logged
Page  of 2 Next >>
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum