Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subtracting date ranges

Status
Not open for further replies.

iao

Programmer
Feb 23, 2001
111
0
0
US
Hi everyone.

I am a new (but constant) user of Crystal Reports, and every so often, I am asked to create a custom report (most are already set up). The reports we create are used to track permit information. The information we collect on permits range from when a permit was applied for, to when it was issued.

I need to create a report where we list all permits, we subtract the date the permit was applied for from the time the permit was issued. This is to give us an idea of how many days elapsed between the two activities.

I have a reports which looks a little like this:

Date received.............02/01/06
Date issued...............02/24/06

Now, I want to add another row which says something like:

Days to issue.............23

I looked at the formula section, and since I am somewhat of a newbie, I cannot get anything to work. I play around with formulas, and I either get an error when trying to save the formula, or I get garbage. I tried the help manual, but to be honest, it's pure garbage.

Is there a simple way to do this? Thanks. :)
 
Try:

{table.dateissued}-{table.datereceived}

Of course I'm guessing that you have 2 different fields.

If you need additional assistance, please post basic technical information:

Crystal version
database/connectivity
Example data
Expected output

-k
 
I apologize. I wasn't clear enough. On the design tab, I have one line of entry:

case_action.action_description......case_action.csa_date3

For the preview page, I get a list of descriptions, with the corresponding date. I want to filter on two specific descriptions (which I know how to do), and with these two descriptions, I want to take one date and subtract it from the other date.

I am on version 7.0.0.0 (don't laugh, it's required for the permit program we use).
 
I'm assuming you have a record selection formula like:

{table.description} in ["A","B"]

...to limit the report to the two descriptions you want to evaluate.

Do you have some field that you are grouping on, e.g., permit number, that organizes the rows into pairs? If there are only two records per group, you could use the following formula in the group footer:

datediff("d",minimum({table.date},{table.permitno}), maximum({table.date},{table.permitno}))

-LB
 
Note what I requested and what you supplied, hence we are still guessing at what it is you have and what you need.

If you only have 2 fields dates, then you might use:

{table.date} - previous({table.date})

If that or LB's suggestion doesn't help, please, take the time to supply basic technical information, you're wasting everyone's time by not doing so.

-k
 
Whoa - I apologize, but I rarely post to forums, so I wasn't sure what you meant. I provided the version number, other that the database/connectivity (I forgot to mention that it was SQL Server), I assumed it was answered in my two previous descriptions.

I guess I just figure it out by myself. Sorry for wasting everyone's time and space.
 
I don't think you need to disappear from this thread. It would help if you provided a little more information though. For example, what is your group structure? What is your record selection formula? Then show some sample data that includes the grouping. Also, you should always try to answer people's questions.

Did you try the suggestions? If so, please explain in what way they didn't work, if they didn't.

-LB
 
Is it that difficult to just paste in some example data?

Check other posts, people supply basic technical information, this is common sense, not the result of some ritualistic protocol, we don't know what your data looks like, and descriptions leave it all to the imagination.

You're telling your auto mechanic that it isn't working right, and when they ask you to tell them what part of the car isn't working right you decide to go work on the car yourself.

I'm not trying to embarass nor offend you, we need to know what you have and what you need.

Post what the current report is supplying, which section it is in, and what you want it to supply...

Honest, we don't know.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top