Skip to Content

background formatting in crystal reports

I have a Crystal Report in Vs 2010. I'm Trying to format the background of a Column, Based on data values. Using this code only the first condition Works because I tried to switch the if conditions and again only the first condition works.

IF {TBM_Report_qry.DiF}<={TBM_Report_qry.tbm} then RGB(234,234,234)
else
(
  IF {TBM_Report_qry.inproduction_DiF}<={TBM_Report_qry.Reqired}
  then RGB(234,234,234)
  else
  (
  IF {TBM_Report_qry.DiF_Close}<={TBM_Report_qry.clse_Diff}
  then RGB(234,234,234)
  )
)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 16, 2015 at 01:26 AM

    I have it Solved

    I just needed to check for null Values!

    Here is the working Formula.

    IF Not ISNULL({TBM_Report_qry.DiF}) AND {TBM_Report_qry.DiF}<={TBM_Report_qry.tbm} then RGB(234,234,234) // uses required date

    else

    IF Not ISNULL({TBM_Report_qry.inproduction_DiF})AND{TBM_Report_qry.inproduction_DiF}<={TBM_Report_qry.Reqired} then RGB(234,234,234) //uses tentative date

    else

    IF  Not ISNULL({TBM_Report_qry.DiF_Close})AND {TBM_Report_qry.DiF_Close}<={TBM_Report_qry.clse_Diff} then RGB(234,234,234) // uses closing date

    else   crNoColor

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 14, 2015 at 09:17 AM

    Hi John,

    Try:

    If ( {TBM_Report_qry.DiF}<={TBM_Report_qry.tbm} OR {TBM_Report_qry.inproduction_DiF} <={TBM_Report_qry.Reqired}  OR {TBM_Report_qry.DiF_Close} <= {TBM_Report_qry.clse_Diff})

    then RGB(234,234,234)

    else crNoColor

    -Abhilash

    Add comment
    10|10000 characters needed characters exceeded

    • Thanks Abhilash Kumar For your reply.

      But it still doesn't work the second and third condition don't get formatted.

      I tried switching the second condition with the first one all the formatting that ocured with {TBM_Report_qry.DiF}<={TBM_Report_qry.tbm} no longer were formatted and the {TBM_Report_qry.inproduction_DiF} <={TBM_Report_qry.Reqired} which were not formatted now they are.

      All this with out modifying the data.

      Thanks in advance.