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!

Help with Looping

Status
Not open for further replies.

NJChris

Technical User
Jul 11, 2005
6
US
Using CR 10

I have a simple report that shows basic employee info with an enter and exit date in the details section. The problem is that if the employee has both an enter and exit date 2 records are returned. The Dates Table has 1 date field and a Boolean isexit field, therefore an employee with both an enter and exit have 2 records. I believe I have to loop over the employee before the dates are returned but although I am familiar with Crystal am lost with this issue.
Any assistance is greatly appreciated
 
I think you could create two formulas:

//{@enter}:
if {table.isexit} = false then {table.date}

//{@exit}:
if {table.isexit} = true then {table.date}

Place these in the detail section. Insert a group on your employee field, and then right click on each of the above formulas and insert a maximum. Drag the results into the group header and then suppress the detail section.

-LB
 
I suggest you do some conditional suppression if you only want to display one record per customer.
You can put this in the Details conditional suppression formula:
not onfirstrecord and {Customer.Customer Name}= previous({Customer.Customer Name}) //substitute your field

(If they're returning an entry date on one Detail line and an exit date on the other, I'd go to the section editor and do something like this: First, conditionally suppress any fields that will be repeated, using a formula like the above, then check "underlay following sections" in the Section expert, rather than suppressing the whole line. That way you'll get the single record and any unique fields.)

There may be an easier way of doing this, but that's what I thought of off the top of my head.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top