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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pulling months from two dates

Status
Not open for further replies.

dg3249

MIS
Jun 11, 2002
41
US
I have an order start date and an order finish date and I need to pull all the months that a particular order spans.

i.e.
start date mar 1,03
finish date jun 30, 03
spans mar, apr, may, jun

How would I achieve this?
Any help would be appreciated.
 
Use something like:
-------------------------------------------------------
Join(["Jan", "Feb", "Mar", "Apr", "May",... "Dec"][Month({start_date})to Month({end_date})], ", ");
-------------------------------------------------------

Of course, complete the rest of the month names instead of the "..."

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Is it possible for you to expand on this.
I'm not sure where the Join fits in..
 
The TGML processing deleted some characters.

Here's a correct version:
-------------------------------------------------------
Join(["Jan", "Feb", "Mar", "Apr", "May",... "Dec"][Month({start_date})to Month({end_date})], ", ");
-------------------------------------------------------

The internal stuff returns all the array elements betrween start and end month.

The join() function then turns the resulting array into a single string (comma separated).

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
It seems to have worked, sort of.
When I insert this formula into my report it pulls all the orders and displays them as follows.

Apr, May, Jun
Order 123

Apr, May, Jun, July
Order 122
Order 124

How do you get it to group so that it shows all orders per month instead of the way it is above.
 
Group your report on either Start_Date or End_Date.
Select "for each Month" as the grouping option in the create/change Group dialog.

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top