crystal-reportsreportcrosstab

cross-tab conditional formatting based on column


I have a cross-tab in crystal reports with column representing transport line, rows showing dates and summary field representing TEU (its just numerical value). So I have something like this:

    L1  L2  L3 TOTAL
D1  10  5   0  15
D2  1   3   5  9
D3  3   50  17 70

Now I'd like to conditionally put background to the summary (numerical) field, but the condition depends also on the line. So in theory, after clicking on the summary field->format field->background->formula I'd put something like this:

select {@Line}
case "L1": (if currentfieldvalue >5 then crGreen else crRed)
case "L2": (if currentfieldvalue >10 then crGreen else crYellow)
case "L3": (if currentfieldvalue <8 then crBlue else crNoColor)

but for some reasons those conditions are completely ignored. I've even tried something as simple as

if {@Line} ="L1" then crGreen

but as above, crystal 2011 (14.06) ignores it.


Solution

  • Got it finally using GridRowColumnValue ("@Line"):

    select GridRowColumnValue ("@Line")
    case "L1": (if currentfieldvalue >5 then crGreen else crRed)
    case "L2": (if currentfieldvalue >10 then crGreen else crYellow)
    case "L3": (if currentfieldvalue <8 then crBlue else crNoColor)
    

    Source: http://www.crystalreportsbook.com/Forum/forum_posts.asp?TID=6798