Print Page | Close Window

Conditional Formating Crosstab Rows

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=6798
Printed Date: 28 Apr 2024 at 2:09pm


Topic: Conditional Formating Crosstab Rows
Posted By: Takesen
Subject: Conditional Formating Crosstab Rows
Date Posted: 19 Jun 2009 at 10:43am
Hmm, This crosstab that i've been working on for past few weeks
(sigh they continuesly want something new with it. o well keeps me workin lol)
 
Now they request some conditional formatting. We have an abnormal_flag_ind that has been combound (is that a word, no red swiggly under it so i guess so hehe...) with the results.
 
So basically there's several ind's in this filed. "A", "N", "H", "HH", "L", and "LL" and for these, we want to change the font of the field
so i wrote this in the x-2 of the style section of the font for these:
 
if IsNull ({abnorm_flags}) or {abnorm_flags} = "" or {abnorm_flags} = "N"
    then crRegular
Else
    if {abnorm_flags} = "H" or {abnorm_flags} = "HH" or {abnorm_flags} = "A"
        then crBold
    Else
        if {abnorm_flags} = "L" or {abnorm_flags} =  "LL"
            then crRegular
 
aswell as this in the color section:
 
if {abnorm_flags} = "L" or {abnorm_flags} = "LL"
      then crSilver
 
But, it doesn't modify anything... Everything looks the same...
any suggestions?
 



Replies:
Posted By: DBlank
Date Posted: 19 Jun 2009 at 12:34pm
Hey Takesen,
You are trying to format cells within the croostab correct?
Try and use the "HighLight Expert".
Right click on the cell you want, clic on NEW to add a new feature
Value of this field is equal to HH set to Bold
add NEW
Value of this field is equal to LL set to Bold and font color to silver,
etc.


Posted By: Takesen
Date Posted: 19 Jun 2009 at 1:52pm

okay, well now i just fill silly for not remembering about the highlighter.

BUT unfortunately the highlighter doesn't appear to be able to work for this....

Because 1, the field i'm basing this off of, is techniqually not IN the crosstab. It's in a formula that the summary is based off of. (the summary is just the Max of the result values for that date)

But the formula is

if IsNull ({abnorm_flags}) or {abnorm_flags} = ""
then
{observ_value}
else
{observ_value} + "  (" + {abnorm_flags} + ")"
 
So i can't really use the formula field to do it, since the highlighter wont let me take the Right( mailto:%7b@Result_abn%7d%29,3 - {@Result_abn}),3 ) which would be the Abnorm_flag....
 


Posted By: DBlank
Date Posted: 19 Jun 2009 at 2:29pm
Not sure you can do this (but I am having a little trouble following the setup).
The question of conditionally formating cells in a crosstab seem to come up a lot ...There is the gridRowcolumnvalue("xxxxxx") but this seems to be more about the value of the column or row header than the returned value in the cell.
I'll keep looking but I am not aware of a good way to do this outside of the highlight expert Confused


Posted By: Takesen
Date Posted: 19 Jun 2009 at 2:35pm
Yeah :(
 
I was looking at the gridrowcolumnvalue and currentvalue..... and i can't seem to grasp the concept....  so i haven't been able to attempt to test this. I'm not sure what else to do...


Posted By: DBlank
Date Posted: 19 Jun 2009 at 2:50pm
gridrowcolumnvalue can be used to change the formating of just one grouping....if gridrowcolumnvalue("table.fieldname")="ABC" then crRed else crBlack
You repalce then{} with "" around the column or row field you want to change and then make it = the header value you want to change.
The currentvalue might be your ticket but again I am not sure what your values are. It does give you a little more control than the highlighter but you are still evaluating the end end result of that cell and not a related field to it.
so you could change font based on the right character of a cell field being = ")" as
if right(currentvalue,1)=")" then crRed else CrBlack
 
Hope this helps.


Posted By: Takesen
Date Posted: 19 Jun 2009 at 3:08pm
Swwwwwwwwwwwweeeeet.
 
if Right(CurrentFieldValue,3) = "H" then
         crBold
Else
          if Right(CurrentFieldValue,3) = "L" then
                   crSilver
 
ect ect works perfect :)



Print Page | Close Window