INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

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

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

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

(OP)
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

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

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[i];
x[i] := {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

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

(OP)
Hi lbass,

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

Regards, Rooski

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

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close