显示参数的描述值

发布于 2024-12-01 01:03:31 字数 151 浏览 1 评论 0 原文

在 Crystal Reports v 11 中,是否可以在报表上显示“参数描述”值,而不是仅显示参数值?每当我将参数拖到报表上显示它时,只显示值,并且我想打印说明。

注意:我使用的是 Crystal 11 (XI),而不是 .NET Crystal Report 插件。

In Crystal Reports v 11, is it possible to display the 'Parameter Description' value on the report, as opposed to only the parameter value? Whenever I drag the parameter onto the report to display it, only the value is displayed, and I want to print the description.

Note: I'm working in Crystal 11 (XI), not the .NET Crystal Report plug-in.

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

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

发布评论

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

评论(6

场罚期间 2024-12-08 01:03:32

我不相信有一种方法可以直接获取描述(散布在互联网上的其他几个帖子似乎也同意)。如果您的参数选项数量较少,您只需创建一个包含 case 语句的公式或函数,该语句会将值转换为其描述。

I don't believe there is a way to directly get at the description (several other posts scattered around the interwebs seem to agree). If you have a small(-ish) number of parameter options, you can just create a formula or function that contains a case-statement that will translate the value to its description.

薄暮涼年 2024-12-08 01:03:32

我感到震惊的是,Crystal Reports 能够以某种方式检索参数的描述,但它不会将其公开以供公式中使用。在我看来,被迫重复参数和描述的定义似乎是一种不好的形式,因为在编程时不应该重复事物。另一种方法(除了列出的所有方法之外)是将您的值和描述设置为 SQL 数据源的值(在 SQL 中对它们进行硬编码)。然后,您可以从所述数据源填充参数,并且您将获得可用字段形式的描述。这样你就只有“一个版本的事实”,将你的价值观映射到你的描述,尽管更感人。

I got over the shock that Crystal Reports somehow is able to retrieve the description of a parameter but it doesn't expose it to be used in formulas. Being forced to duplicate the definition of parameters and description seems to me bad form, simply because one is not supposed to duplicate things when programming. An alternative hack (besides all the ones listed) would be to make your Values and Descriptions as values of a SQL data source (hardcode them in SQL). Then you can populate your parameter from said data source and you will have the Descriptions available as a field. That way you only have "one version of the truth" that maps your values to your descriptions, although more moving pieces.

俯瞰星空 2024-12-08 01:03:32

请参阅:1678487 - 如何在 Crystal Reports 中显示参数描述而不是参数值:https://apps.support.sap.com/sap/support/knowledge/public/en/1678487

See: 1678487 - How to display parameter descriptions instead of parameter values in the Crystal Reports at: https://apps.support.sap.com/sap/support/knowledge/public/en/1678487

意犹 2024-12-08 01:03:32

有一个新函数实际上可以用于在报告上显示参数的描述。

来源:https://launchpad.support.sap.com/#/notes/2037542< /a>

我将为那些无需访问此页面的用户粘贴整个文档。

Crystal Reports 2016 中添加了一个新函数 GetValueDescriptions(),允许用户创建可以操作/显示参数所选值的描述的公式。

GetValueDescriptions() 支持各种参数(单个和多个、离散和范围)。下面是一个公式示例,其中 {?customerMultiDiscreteAndRange} 是多个范围参数:

local stringVar range array im := GetValueDescriptions ({?customerMultiDiscreteAndRange});
本地编号Var i := 1;
本地 stringVar 输出 := "";

当 i <= count(im) 时

if (InincludesLowerBound ({?customerMultiDiscreteAndRange}[i])) then
( 输出 := 输出 + "["; )
别的
( out := out + "("; );

if (HasLowerBound ({?customerMultiDiscreteAndRange}[i])) then
( out := out + GetLowerBound(im[i]) );

输出:=输出+“..”;

if (HasUpperBound ({?customerMultiDiscreteAndRange}[i])) then
( out := out + GetUpperBound(im[i]) );

if (InincludesUpperBound ({?customerMultiDiscreteAndRange}[i])) then
(输出:=输出+“]”;)
别的
( 输出 := 输出 + ")"; );

如果 (i < count(im)) 那么
输出:=输出+“,”;

我:=我+1;
);

out;

还要注意两个新函数 - GetLowerBound() 和 GetUpperBound(),它们可用于获取正确的下限/上限描述。如果Maximum()和Minimum()返回交换的描述,这两个特别有用。

上述公式示例可以轻松调整,例如同时显示值和描述,或满足更多报告需求。

要使用这些功能,请将 Crystal Reports 升级到已进行增强的版本。

有关详细信息和可用补丁,请参阅 SP 补丁级别部分。

对于 SAP Crystal Reports(Eclipse 运行时版本):

仅自 SP22 起运行时才支持这些函数,但有以下限制:

SAP Crystal Reports(Eclipse 运行时版本)不支持静态多范围参数,这与以前相同。支持动态多范围参数。
SAP Crystal Reports(Eclipse 版本)的嵌入式设计器不支持显示描述的“值选项”。如果您在 SAP Crystal Reports 2016 中设计了一个现有报表,其中使用参数的“值选项”来显示说明,则在嵌入式设计器中重新保存的任何修改都将覆盖“值选项”以显示值。相反,SAP Crystal Reports(Eclipse 运行时版本)支持在 SAP Crystal Reports 2016 中使用“值选项”显示说明创建的报表。
要下载 SAP Crystal Reports Eclipse 版本的最新支持包:

https://wiki.scn.sap.com/wiki/display/BOBJ/SAP+Crystal+Reports+version+for+Eclipse+-+下载

There is a new function that can actually be used for displaying the descriptions of a parameter on a report.

Source : https://launchpad.support.sap.com/#/notes/2037542

I will paste the entire document for those users who don't have to access to this page.

A new function GetValueDescriptions() is added in Crystal Reports 2016, to allow user create formula that could operate / display descriptions of selected value for a parameter.

GetValueDescriptions() supports all kinds of parameters (single and multiple, discrete and range). Below is an formula example where {?customerMultiDiscreteAndRange} is a multiple range parameter:

local stringVar range array im := GetValueDescriptions ({?customerMultiDiscreteAndRange});
local numberVar i := 1;
local stringVar out := "";

while i <= count(im) do
(
if (IncludesLowerBound ({?customerMultiDiscreteAndRange}[i])) then
( out := out + "["; )
else
( out := out + "("; );

if (HasLowerBound ({?customerMultiDiscreteAndRange}[i])) then
( out := out + GetLowerBound(im[i]) );

out := out + "..";

if (HasUpperBound ({?customerMultiDiscreteAndRange}[i])) then
( out := out + GetUpperBound(im[i]) );

if (IncludesUpperBound ({?customerMultiDiscreteAndRange}[i])) then
( out := out + "]"; )
else
( out := out + ")"; );

if (i < count(im)) then
out := out + ", ";

i:= i + 1;
);

out;

Also note two new functions - GetLowerBound() and GetUpperBound(), they can be used to get correct lower / upper bound descriptions. These two are especially useful if Maximum() and Minimum() returns swapped descriptions.

Above formula example can be adjusted easily, e.g. to show both the value and descrition, or to satisfy more reporting needs.

To use these functions, upgrade your Crystal Reports to a release where the enhancement has been made.

See the SP Patch Level section for details and available patches.

For SAP Crystal Reports, version for Eclipse:

These functions are supported for runtime only since SP22, with following limitations:

Static multi-range parameters are not supported in SAP Crystal Reports, version for Eclipse runtime, which is the same as before. Dynamic multi-range parameters are supported.
"Value Options" to show description is not supported in the embedded designer in SAP Crystal Reports, version for Eclipse. If you have an existing report designed in SAP Crystal Reports 2016 with parameters' "Value Options" to show description, any modification resaved in the embedded designer will overwrite the "Value Options" to show value. Instead, reports created in SAP Crystal Reports 2016 with the "Value Options" to show description is supported in SAP Crystal Reports, version for Eclipse runtime.
To download the latest Support Packages of SAP Crystal Reports, version for Eclipse:

https://wiki.scn.sap.com/wiki/display/BOBJ/SAP+Crystal+Reports+version+for+Eclipse+-+Downloads

我不咬妳我踢妳 2024-12-08 01:03:31

我同意 Ryan 的观点——没有一种本地机制可以获取这些值。用户函数库(UFL)可能是一种值得研究的方法。

相反,我通过多种方式处理这个问题:

  1. 使用带有 case 语句的公式将值转换为描述。
  2. 与 #1 执行相同操作的自定义函数;自定义函数可以通过 BOE 存储库与其他报告共享,
  3. 使用子报告来查询可以将值转换为描述的表。将值存储在详细信息部分(抑制)的数组中,然后 Join() 报表页脚中的数组。如果您将子报表嵌入到其自己的部分中,它将根据需要扩展以容纳扩展列表,
  4. 您可以调整 #3 以使用 BO 的查询作为 Web 服务 (QAAWS) 公开的值列表,但我还没有' t对此进行了实验。如果没有关联的架构文档,CR 将无法使用 XML Web 服务作为数据源。

I agree with Ryan--there isn't a native mechanism to grab these values. A user-function library (UFL) might be an approach worth investigating.

In lieu of that, I handle this a number of ways:

  1. a formula with a case statement to convert the value to a description.
  2. a custom function that does the same a #1; custom functions can be shared w/ other reports via the BOE repository
  3. use a subreport to query a table that can covert the value to a description. store the values in an array in the Detail section (suppressed), then Join() the array in the report footer. if you embed the subreport in its own section, it will expand as needed to accommodate an expansive list
  4. you might be able to adapt #3 to use a list of values exposed by BO's query as a web service (QAAWS), but I haven't experimented with this. If it doesn't have an associated schema document, CR won't be able to use the XML webservice as a data source.
萌︼了一个春 2024-12-08 01:03:31

首先将参数值和描述连接在一起,并使用竖线“|”分隔两个值或其他较少使用的字符

示例:
客户 ID、客户名称 -> 12345|ABC Company

第二 使用带有数组的水晶函数来显示报告上的说明部分,即分隔字符

Numbervar i;
Numbervar j;
StringVar Array z := "";

Local StringVar Array x := split(Join({?My Parameter},";"),";");

j := count(x);

redim preserve z[j];

for i := 1 to j do(
z[i] := right(x[i],Length(x[i])-instr(x[i],"|")) 
);

join(z,",")

第三之后的所有内容。 创建第二个函数(如上面的函数)将参数值返回到分隔符左侧,以用作报表选择公式的一部分**

First, Concatenate the parameter value and the description together and delimit the two values using a pipe '|' or other lesser used character

Example:
CustomerID, CustomerName -> 12345|ABC Company

Second Use a Crystal function with an array to display the description side on your report i.e everything after your delimiting character

Numbervar i;
Numbervar j;
StringVar Array z := "";

Local StringVar Array x := split(Join({?My Parameter},";"),";");

j := count(x);

redim preserve z[j];

for i := 1 to j do(
z[i] := right(x[i],Length(x[i])-instr(x[i],"|")) 
);

join(z,",")

Third. Create a second function like the one above to return the Parameter value to the left of the delimiter to use as part of the report's Selection Formula**

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