Crystal Reports:全局变量运行总计未显示在标题中

发布于 2024-08-09 15:19:24 字数 496 浏览 12 评论 0原文

使用 Crystal Reports 我试图在标题中显示数据库字段的运行总计,其中所有的标签都是。

我尝试通过将运行总计(RTversion)放入具有以下内容的公式字段中来实现此目的:

Shared stringvar CurrentVers; 
CurrentVers := {#CurrentVers}; 

然后在页眉部分中我有以下内容:

Shared stringvar CurrentVers; 
EvaluateAFter({#currentVers}); 
CurrentVers; 

{#CurrentVers}运行第一个最大的数字。

这是不正确的吗?

更新:目标是在标签附近的标题中显示最新版本,以显示当前版本用于比较。

Using Crystal Reports I'm trying to display the running total of a database field in the header where all the labels are.

I've attempted to do this by placing the running total (RTversion) into a formula field with the following:

Shared stringvar CurrentVers; 
CurrentVers := {#CurrentVers}; 

and then in the page header section I have the following:

Shared stringvar CurrentVers; 
EvaluateAFter({#currentVers}); 
CurrentVers; 

with {#CurrentVers} running the 1st largest number.

Is this incorrect?

Update: The goal is to display the latest version in the header near the labels to show what the current verseion is for comparison.

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

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

发布评论

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

评论(6

红衣飘飘貌似仙 2024-08-16 15:19:24

根据我的经验,运行总计字段仅适用于页脚部分。

您将需要创建手动运行总计。

将公式字段添加到“详细信息”部分,用您要捕获的任何内容填充全局变量。类似于:

//use WhileReadingRecords if the values can be gathered as the report pulls in values from the database.  Otherwise, use WhilePrintingRecords. 
WhileReadingRecords;
Global Stringvar CurrentVers;
//logic here to capture what you want
CurrentVers:=...

将另一个公式字段添加到标题部分。将这两行添加到其中:

WhilePrintingRecords;
Global Stringvar CurrentVers;

Running-Total Fields, in my experience, only work in the footer sections.

You will need to create a manual running total.

Add a formula field to the Details section that populates a Global variable with whatever you are trying to capture. Something like:

//use WhileReadingRecords if the values can be gathered as the report pulls in values from the database.  Otherwise, use WhilePrintingRecords. 
WhileReadingRecords;
Global Stringvar CurrentVers;
//logic here to capture what you want
CurrentVers:=...

Add another formula field to the Header section. Add these two lines to it:

WhilePrintingRecords;
Global Stringvar CurrentVers;
不必在意 2024-08-16 15:19:24

创建一个像这样的公式

formula = Count ({Field to count},{GroupFieldName}) 

并将其放置在组标题部分。

Create a formula like this

formula = Count ({Field to count},{GroupFieldName}) 

and place it in group header section.

春风十里 2024-08-16 15:19:24

我想通了..

我必须在主报告中添加一个子报告。我复制了主报告并将其重命名为子报告。在子报表中,我添加了一个共享变量,然后将其传递给主报表。诀窍是将子报表放置在同一组标题中,但在需要抑制的部分之上放置一个单独的部分。我实际上添加了以下部分:

新部分(同一组-我在这里放置了子报告;不要抑制)
新部分(同一组 - 我在这里放置共享变量值;不要抑制)
原始部分(具有我需要根据运行总计抑制的标题的同一组)

I figured it out..

I had to add a subreport to the main report. I copied the main report and renamed it as a subreport. In the subreport, I added a shared variable and then passed it to the main report. The trick is to place the subreport in the same group header, but a separate section above the section that needs to be suppressed. I actually added the following sections:

New section (same group-I placed subreport here; do not suppress)
New Section (same group - I placed shared variable value here; do not suppress)
Original Section (same group that has a header I need suppressed based on a running total)

趴在窗边数星星i 2024-08-16 15:19:24

如果 {#CurrentVers} 是常规运行总计字段,您应该能够将其直接放置在页眉中,而不是诉诸其他公式。我认为这里不需要任何一个公式字段,除非 {#CurrentVers} 的组成中有一些不寻常的东西,并且“最大数字”运行总计不需要任何异常的东西。

If {#CurrentVers} is a regular running total field, you should be able to place it in the page header directly rather than resort to an additional formula. I don't see the need for either formula field here, unless there's something unusual in the composition of {#CurrentVers} and a 'largest number' running total shouldn't require anything out of the ordinary.

↘紸啶 2024-08-16 15:19:24

您只需使用一个公式字段即可解决此问题:

WhilePrintingRecords;
// Enter logic here e.g.
// maximum({mytable.myfield});

WhilePrintingRecords; 强制在从数据库读取所有记录之前不计算公式,因此即使放置公式字段也会显示正确的结果在标题中。

You can solve this with just one formula field:

WhilePrintingRecords;
// Enter logic here e.g.
// maximum({mytable.myfield});

The WhilePrintingRecords; forces the formula to not be evaluated until all records have been read from the database, and therefore the formula field will display the correct result even if placed in a header.

寂寞花火° 2024-08-16 15:19:24

我发现关键是传递的公式字段需要放在子报表上。我将其放在页脚中然后将其抑制。

The key I found is that the formula field being passed needs to be placed on the subreport. I placed mine in the footer then suppressed it.

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