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!

Removing days from datefield!

Status
Not open for further replies.

IKONOS

Technical User
May 2, 2001
20
0
0
US
I've created a report in which I'm capturing elapsed time values from a create date and end date data field. My question: Is there a formula or simpler method to "only capture" Monday through Friday... and excluding Sat. and Sun???
Any help would be appreciated!

Mark
 
See my FAQ in the general CR forum on Common Formulas. Formula 1 is for business days, and Formula 13 is for adjusting it for Business hours. Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Thanks for your reply Ken!
I read your FAQ and that, for the most part addresses my question. Although I probably should have explained that the data I'm working with changes on a daily basis. The start date and end date fields change every day. Therefor, I'm not really working within a range, but more a specific timeframe.
Basically, I just want to take Saturday & Sunday out of the report all together.

Thanks,
Mark
 
Mark,

I am not sure what you mean capture, since this is a term that could be used to mean many different things.

You could be trying to exclude specific RECORDS from the report, because those records have a date that falls on the weekend. This would be a selection issue. In other words only include order RECORDS processed Monday through Friday.

Or, you could be trying to calculate an elapsed period based on a start date and an end date and only wanting to include days that aren't weekends.

Which are you trying to do. Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Hey Ken.

Thanks for getting back with me.

I'm trying to do what you mentioned first... trying to exclude records with Saturday and Sunday in the date field.
 
Create a formula field called @DayOfWeek:

DayOfWeek({Your.DateField})

This will be a number from 1 - 7, with one being Sunday.

Now add a rule in the select expert that says:

DayOfWeek - Is Between - 2 and 6
Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Keep in mind that this will eliminate records from the report. It will not have any effect on date math done with 2 dates in the same formula. Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Ken.
Could ypu please show me how the formula should look. I am very new to Crystal and am not completely comfortable with using it.

Thanks.
Mark
 
I showed you how the formula would look in my last post.

The select expert is not a formula but pull down menus. Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
I tried something a bit more comlpex along these lines. The client wanted working days, so a simple Monday thru Friday was insufficient. This was a manufacturing company running MRP and the MRP Package had a shop calendar where the working days were defined (and hours as well, by work center -- some work centers have 2 shifts). I linked this table to the report and used it to ddetermine working days and hours.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top