For each crosstab column, highlight maximum value

匆匆过客 提交于 2019-12-02 14:08:44

问题


I'm trying to highlight the maximum value in a Crystal Reports crosstab column, per column, i.e. show the best performing salesman in each month.

It seems like a fairly basic requirement, but I can't figure it out! The Highlighting Expert would seem to be the obvious answer, but it only works if you have defined criteria (e.g. Gross Sales > 120,000), and I'm not interested in highlighting the Totals at the end of the columns/rows....I just want the highest value row per column.


回答1:


This is much more difficult than it needs to be...

Add this text to the summary field's "Tool Tip Text" conditional-formatting formula:

// this assumes that there is a Total column and that it is the left-most column.

Numbervar max:=0;
local Numbervar col;

// exclude (left-most) total column
for col := 1 to GetNumColumns-1 do (

    local numbervar value := GridValueAt (CurrentRowIndex, col, CurrentSummaryIndex);
    if value > max then max := value;

);

ToText(max,"#");

Then add this text to the same field's "Style" conditional-formatting formula:

Numbervar max;

If GridValueAt (CurrentRowIndex, CurrentColumnIndex, 0) = max Then
    crBold
Else
    crRegular


来源:https://stackoverflow.com/questions/10418114/for-each-crosstab-column-highlight-maximum-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!