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!

Displaying one record from each group 1

Status
Not open for further replies.

shaleen7

MIS
Jun 23, 2002
188
US
I've got a report where I'm trying to display the field where there is a checked box and if there isn't I want to print the words "No responsible employee identified"

Each app has several employees working on it but only one is responsible for the entire app. The responsible employee has a checked box next to their name.

For example:
App No#1
1. Riley X (responsible)
2. Smith
3. Bass

App No #2
1. Moss
2. Dunn X (responsible)

App No #3
1. Kelly X (responsible)

App No #4
1. Krate ("No responsible employee identified")
2. Donell

I thought the following formula would display the responsible employee for each app and if there wasn't a responsible employee identified then it would display "No responsible employee identified":

If {TableEmployee_.CHARGE} = '1' then {TableEmployee_name} else "No responsible employee idenified".

Current Results:
App No #1 Riley X (responsible)
"No responsible employee identified"
"No responsible employee identified"

App No #2 "No responsible employee identified"
Dunn X (responsible)
App No #3 Kelly X (responsible)
App No #4 "No responsible employee identified"
"No responsible employee identified"

I only want one result for each app no either the responsible employee is checked or it says "No responsible employee identified":


Desired Results:
App No #1 Riley X (responsible)
App No #2 Dunn X (responsible)
App No #3 Kelly X (responsible)
App No #4 "No responsible employee identified"


Any suggestions would be appreciated.
Thanks


 
Your post might confuse many when you state things "I'm trying to display the field where there is a checked box", just state that there's a field with a 1 or 0 indicating whether to select this person. The field doesn't have a box that's checked, right?

Group by the App, suppress the group header and the details, and use the 3 formula method:

In the Group Header:
whileprintingrecords;
Stringvar Results:= "No responsible employee identified";

In the Details:
whileprintingrecords;
Stringvar Results;
If {TableEmployee_.CHARGE} = '1' then
Results:= {TableEmployee_name};

Display the results in the group footer formula:
whileprintingrecords;
Stringvar Results

-k

 
Another approach might be:

If {TableEmployee.Charge} is either "1" or "0", you could sort on {TableEmployee.Charge}, descending. Then drag your original formula:

If {TableEmployee.CHARGE} = '1' then {TableEmployee.name} else "No responsible employee identified"

...into the group header. Or sort ascending on {TableEmployee.Charge}, and drag the formula into the group footer.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top