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

Crosstab - highlight a row only when two or more column values in the row are greater than zero 1

Status
Not open for further replies.

Rooski

Technical User
Sep 28, 2004
44
US
Hello to All,

I am using Crystal Reports Version 10. I have created a conventional crosstab with employee serial number in the rows and with unit of assignment in the columns. There are about 20 units of assignment in total. I am counting issued traffic tickets in the summary field. It is possible for some employees to be involved with more than one unit of assignment. In these cases, their row may contain two or more issued tickets counts greater than zero in the columns.

Is there a way to highlight only those rows in which two or more column counts are greater than zero? I have successfully used gridrowcolumn value logic and currentfield value logic in the past. I just can't figure out how to apply it to the situation above or if it is even possible. I have searched existing threads, but could not find anything helpful.

Thanks in advance for any help,

Rooski
 
First, make sure you have a group on {table.employeeID} in the main report (it can be suppressed). Then create a formula {@dcntunit}:

distinctcount({table.unit},{table.employeeID})

Add this as a summary field in the crosstab and insert a maximum on it. In the crosstab expert, move the summary into the top position in the summary box.

Next, select the row total (if used) and row cell->right click->format field->suppress->x+2 and enter:

whileprintingrecords;
numbervar a := currentfieldvalue;
true

Then select the ticket count summary field->right click->border->background->x+2 and enter:
whileprintingrecords;
numbervar a;
if a > 1 then
cryellow else
crnocolor;

In design mode, grab the boundaries of the suppressed summary (maximum of {@dcntunit}) both in the row total and inner cell and minimize the height.

If you want to also highlight the label, create a formula like this and place it in the employee group header:

whileprintingrecords;
numbervar array x;
numbervar i;

if
distinctcount({table.unit},{table.employeeID})>1
then (
i := i + 1;
redim preserve x;
x := {table.employeeID};
);

Then select the row label->right click->format field->border->background->x+2 and enter:

whileprintingrecords;
numbervar array x;
if gridrowcolumnvalue("Orders.Employee ID") in x then
cryellow else
crnocolor

-LB
 
Hi lbass,

Thank you for the quick response. I will set this up, try it out, and let you know the outcome.

Regards, Rooski
 
Hello lbass,

Your instructions and code worked perfectly (as always)! Super job. Would never have come up with this on my own in 100 years.

Thanks again, Rooski
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top