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

Date Day Increment for a Crystal Report form

Status
Not open for further replies.

RedSparks

Technical User
Nov 6, 2003
24
US
I am creating a form where the user will input the beginning and ending date for the week they are wanting printed out.

The form needs to print for each day and displaying the date and the day of the week on seperate pages. (ie. date: "11/10/03" and the Day of the week is: "Monday"; next page would display the date: "11/11/03" and the Day of the week is: "Tuesday", etc.

What is the best way to go about doing this?



 
The best way would be to describe the intent technically, such as I'm using Crystal Reports 8.5, a form within VB 6, a SQL Server database, and although the data may not hold each day, I need all dates on seperate pages.

Perhaps you're using the term form when you mean the report?

Crystal itself can prompt for parameters. Use Insert->Field Object->Right click parameters and select New.

If your data doesn't have all dates, then you'll either have to fabricate dates in CR, or better yet, create a Periods table that does contain all dates and use a Left Outer join to your data.

As for the display of the day name, just use the weekdayname(weekday({table.date})) to get it.

-k
 
I'm working in CR 9, db SQL.

I'm creating a Report "Form" that prints out the data for each client by transportation route. The form needs to have the same client information on each form. The only thing different is that it is for a different vehicle and it must print out for each day of the week. The driver will use the form to denote each client he/she picks up or drops off.

I've gotten the day of the week to come out correctly based on 1 date input, but I need to have the form print for each date in a selected range. The date information is not contained within the data tables.

Is there a way to create a formula that will generate an incremented date and print a form by date?

 
Again, Crystal doesn't have forms, are you sure that you're using Crystal and not VB?

Or perhaps you just prefer to arbitrarily rename things to add to my general confusion?

There are different vehicles, yet the date dat isn't in the tables? How will the report determine which vehicle is for which date?

You should explain your data layout, and try to do so using example data and expected layout, text descriptions are generally inferior.

-k
 
Okay, let me start again. I am creating a Vehicle transportation form for the drivers of the different vehicles to fill out each morning and afternoon daily for each client they pick up.


Vehicle: Mini Van
Day of the Week: Monday
Date: 11/10/03

Route: NW - Northwest Route
Client Name A.M. Pickup P.M. Pickup

Suzy Smith

Michael Jones

Michelle Lee

Route: SW - Southwest Route
Client Name A.M. Pickup P.M. Pickup

Ron Howard

Andy Griffith

Vehicle: Mini Van
Day of the Week: Tuesday
Date: 11/11/03

Route: NW - Northwest Route
Client Name A.M. Pickup P.M. Pickup

Suzy Smith

Michael Jones

Michelle Lee

Route: SW - Southwest Route
Client Name A.M. Pickup P.M. Pickup

Ron Howard

Andy Griffith

Vehicle: Mini Van
Day of the Week: Wednesday
Date: 11/12/03

Route: NW - Northwest Route
Client Name A.M. Pickup P.M. Pickup

Suzy Smith

Michael Jones

Michelle Lee

Route: SW - Southwest Route
Client Name A.M. Pickup P.M. Pickup

Ron Howard

Andy Griffith

Vehicle: Mini Van
Day of the Week: Thursday
Date: 11/11/03

Route: NW - Northwest Route
Client Name A.M. Pickup P.M. Pickup

Suzy Smith

Michael Jones

Michelle Lee

Route: SW - Southwest Route
Client Name A.M. Pickup P.M. Pickup

Ron Howard

Andy Griffith

-----------------------------------------------------------
The same information is to repeat on the report for each day in the date range selected, using a begin date and End date parameters. The information on this report will then be used to enter the information into the attendance program for each client after the fact.

Does this make more sense? Thanks!

 
If the day and date are always on a new page, then the following formulas should work:

{@day}:
weekdayname(dayofweek({?Date}+pagenumber-1))

{@date}:
{?Date}+pagenumber-1

where {?Date} is a discrete date parameter representing the start date.

However, it is unclear what data you are using to force the cycle through the days or what would cause the name fields to repeat by day in the absence of actual data--but maybe this is the issue?

If the names, etc., are hard coded in, e.g., added through text boxes, and there is no active data, then I think you could create a table in Excel, e.g., with numbers from 1 to N, where N = the maximum range of days you would want to print the forms for.

Then add this to your report as a datasource. Add the Excel number field to the detail section and then go to format section->details->and check "new page after" and in the formula section for this, add: Not OnLastRecord. This will force N pages. You could add the formulas above and all the other info to the details section.

You could make a number parameter to limit the number of pages using the Excel N field. The record selection would look like:

{Exceltable.number} <= {?Npages}

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top