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!

Display 2 records on one line

Status
Not open for further replies.
Apr 23, 2002
6
NZ
Hi All
A persons entry and exit times are stored in my database as separate records like this:
Name Date Time
Brian 17/07/06 12:30
Brian 18/07/06 6:00
Brian 20/07/06 2:00
Brian 20/07/06 15:00
Fred 17/07/06 16:00
Fred 18/07/06 21:00

The first record is an entry time and the next is an exit time. So the entry and exit times always follow each other and one person can enter and exit several times.

How do I get an entry and exit time to display on one line like this:
Name Entry Time Exit Time
Brian 17/07/06 12:30 18/07/06 6:00
Brian 20/07/06 2:00 20/07/06 15:00
Fred 17/07/06 16:00 18/07/06 21:00

I'm using CR 9
Any help will be much appreciated
 
Seems insane to have just dates with no field indicating which is the entry/exit time, or are you holding back basic information?

Anwyay, this is fairly easy, group by the name field, suppress the details and the group header and place the following formula in the group header:

whileprintingrecords;
datevar LastDate := {table.date};
timevar LastTime := {table.time};

Now in the group footer place

Name

whileprintingrecords;
{table.date}

Entry date
whileprintingrecords;
datevar LastDate

Entry time
whileprintingrecords;
timevar LastTime

Exit date
{table.date}

Exit date
{table.time}

Plenty of assumptions here, such as you having seperate fields for the date and time, would have been simpler if this wasn't the case, you could just group by the name and use:

minimum({table.dateime},{table.name})

and

maximum({table.dateime},{table.name})

to return the values of the min and max.

-k
 
Thanks for the reply synapsevampire

However this only returns one line for each person. ie their first and last record. I want to be able to display several lines for each person if they have several entry and exit's bearing in mind every second line is an exit entry.

Is there any way to do this?

Cheers
 
Place the fields in the details and right click the details and select section expert and in the X2 next to suppress place:

remainder(recordnumber,2) <> 0

Then just create formulas:

whileprintingrecords;
previous({table.date})

whileprintingrecords;
previous({table.time})

whileprintingrecords;
{table.date}

whileprintingrecords;
{table.time}

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top