Print Page | Close Window

color formatting

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=22675
Printed Date: 03 May 2024 at 11:31am


Topic: color formatting
Posted By: Tori_Dee
Subject: color formatting
Date Posted: 27 Sep 2018 at 7:26am
Hi,

The field {flaglevel} is a string that pulls in a number.
I am creating a color formatting formula for the field {nresult} which is a number.

I currently have this formula in the x-2 next to color in {nresult} :
If {PRM_SxData.nResult} > tonumber({PRM_SxData.FlagLevel})
then crRed
Else crBlack

I am using the same formula in (@violation) with a minor change:
If {PRM_SxData.nResult} > tonumber({PRM_SxData.FlagLevel}) then "!"
Else " "

//On our report wherever there is red result there needs to be an "!" to better alert clients in case they print the report in b&w.

The formulas work like a charm except we noticed that sometimes {flaglevel} populates with 0.
In this case I want {nresult} to be crblack even if {nresult} is >0 because 0 is not important.

so if {flaglevel} populates >0 then {nresult} needs to be red and (@violation) needs to return "!".
if {flaglevel} populates =0 then {nresult} needs to be black and (@violation) needs to return nothing.



Replies:
Posted By: hilfy
Date Posted: 01 Oct 2018 at 5:57am
I would change the "If" part of your formulas to this:

If (tonumber({PRM_SxData.FlagLevel}) > 0) and ({PRM_SxData.nResult} > tonumber({PRM_SxData.FlagLevel}))

-Dell

-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window