根据同级值突出显示 Crystal Reports 交叉表中的值

发布于 2025-01-03 15:13:31 字数 1102 浏览 1 评论 0原文

我有交叉表,其中的行列指示不同的类别,然后在顶部显示人员姓名。

|         | Required | Person 1 | Person 2 | Person 3 |
| Class 1 | 8      6 | 1      6 | 3      6 | 4      6 | 
| Class 2 | 6      2 | 3      2 | 2      2 | 1      2 |

每个字段包含 2 个值。第一个值是在课程中花费的小时数,第二个字段是认证所需的小时数。

必填字段是我的总计摘要。

在交叉表专家中,字段定义如下。

行:

Command.descr ->包含类名的字段

Columns:

Command.fullname ->包含学生全名的字段

汇总字段:

Command.evlength 的总和 ->在给定课程中花费的所有时间的总和

Max of @required ->此公式根据课程名称返回所需的小时数

我试图突出显示字段Sum of Command.evlength(如果它大于或等于@required的Max的值)

我的解决方案是执行后台格式化。右键单击“Sum of Command.evlength”字段,选择“设置字段格式”。单击边框选项卡,选中背景,然后输入公式。

我使用的公式是:

if CurrentFieldValue >= {@required} then color(152, 251, 152) else crNoColor

这不是正确的公式。我的交叉表已放置在页脚中,这导致 {@required} 包含网格中的最后一个值,在上面的示例中为 2。

根据我的研究,我认为我必须使用 GridRowColumnValue(行或列名称)来访问交叉表中 {@required} 的值,但我无法想出正确的字符串来表示它。

有人有办法让我正确地进行这种比较吗?

I have crosstab which has row columns indicating different classes, and then peoples names across the top.

|         | Required | Person 1 | Person 2 | Person 3 |
| Class 1 | 8      6 | 1      6 | 3      6 | 4      6 | 
| Class 2 | 6      2 | 3      2 | 2      2 | 1      2 |

Each field contains 2 values The first value is the number of hours spent in the class, the second field is the number of hours required for certification.

The Required field id my grand total summary.

In the cross tab expert the fields are defined as follows.

Rows:

Command.descr -> a field containing the class names

Columns:

Command.fullname -> a field containing students full names

Summarized Fields:

Sum of Command.evlength -> summation of all time spent in a given course

Max of @required -> this formula returns the number of required hours based on the course name

I am trying to highlight the field Sum of Command.evlength if it is greater than or equal to the value of Max of @required.

My solution was to perform background formatting. Right-Click on the Sum of Command.evlength field, select Format Field. Click the borders tab, check Background, and enter a formula.

The formula I was using is:

if CurrentFieldValue >= {@required} then color(152, 251, 152) else crNoColor

This is not the correct formula. My crosstab has been placed in the footer, which causes {@required} to contain the last value in the grid which in the above example is 2.

From my research I thought I would have to use GridRowColumnValue(row or column name) to access the value of {@required} in the crosstab, but I could not come up with the correct string to represent it.

Does anyone have a way for me to correctly perform this comparison?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

榕城若虚 2025-01-10 15:13:31

令人沮丧的是,我认为您无法使用突出显示专家来与动态值进行比较。您可以交换列,然后添加以下公式:

到 max_of_required 背景颜色:

whileprintingrecords;
global numbervar required_hrs := currentfieldvalue;
crNoColor;

到 sum_of_command.evlength 背景颜色:

whileprintingrecords;
global numbervar required_hrs;
if currentfieldvalue >= required_hrs then
 crRed
else
 crNoColor;

我认为还有其他一些方法,但我对这些方法不太有信心,所以从这里开始。

Frustratingly I don't think you can use the highlighting expert to compare to a dynamic value. You could swap the columns round then add the following formulas:

To the max_of_required background colour:

whileprintingrecords;
global numbervar required_hrs := currentfieldvalue;
crNoColor;

To the sum_of_command.evlength background colour:

whileprintingrecords;
global numbervar required_hrs;
if currentfieldvalue >= required_hrs then
 crRed
else
 crNoColor;

I think there are a few other ways but i'm not as confident with those so start here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文