Crystal Reports:交叉表列排列

发布于 2024-09-28 16:27:01 字数 370 浏览 1 评论 0 原文

我正在寻找交叉表中的出路,以便如果交叉表中的列超出,它们不应该进入下一页......而新的交叉表应该在第一个交叉表之后重复。

例如,交叉表中显示两列:

alt text

现在,如果添加了新列,并假设它如果无法容纳在给定的页面宽度限制内,则默认会转到 CR 中紧邻的页面。

但在我的报告中,它需要显示在第一个交叉表下方(而不是下一页),如下所示:

“alt

如果有出路,请给我建议:)

提前致谢

I am looking for a way out in cross tab, so that if the columns exceed in cross tab, they shouldnt go on next page..rather a new cross-tab should repeat after the first one.

For example, two columns are displayed in a cross tab :

alt text

Now if a new column is added, and assuming that it could not be accomodated within the given page width limit, it will go to a page next to it in CR by default.

But in my report it is required to be shown below the first cross tab (and not on next page), which will look as follows:

alt text

Please do suggest me if there's a way out :)

Thanks in advance

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

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

发布评论

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

评论(2

云淡月浅 2024-10-05 16:27:01

你的问题是完全合理的,但我很确定在 CR-XI 中,没有自动的方法来做到这一点。我建议完全跳过交叉表设计器,直接创建自己的交叉表设计器:

  1. 使用恰好有 1 条记录的占位符表创建一个新的 CR。
  2. 在此 CR 中,抑制除详细信息部分之外的所有内容。添加一个新的详细信息部分,这样您将拥有 Da 和 Db。
  3. 在Da中,添加一个子报表。使用您的真实数据源并添加 Column1 和 Column2。
  4. 在Db中,添加一个子报表。使用您的真实数据源并添加 Column3 和 Column4。

我没有时间测试这个,但我认为它会按照您的要求显示所有列。

(您可以在报表中使用只有 1 个组的 placegrouper 组,而不是步骤 1。然后,当您添加子报表时,请确保不添加任何指向主报表的链接。)

编辑

动态列数使得这个要求在 Crystal 中更难做到。

  1. 也许您可以从脚本自动生成整个报告。我无法帮助您,但我相信 StackOverflow 上的其他人会。

  2. 您可以使用 MS Excel 来实现类似的目的。使用 MS Access 或类似的工具来设置数据的交叉表。打开一个新的 Excel 工作簿,然后使用数据->导入外部数据->导入数据导入交叉表数据源(这将导入整个表,无论行数如何)。在页面设置中,将设置更改为适合(空白)页面宽×1页高。您可以按照自己喜欢的方式设置数据格式,并且格式将保留。此 Excel 方法会将所有列压缩到 1 页宽的区域中。这不完全是您所要求的,但它会起作用。

  3. 列数可能是动态的,但您知道字段名称​​可能是什么吗?例如,您的列包括 0-50 个美国州,那么您知道列名称是什么,但不知道是哪些或有多少个。如果这是您的情况,请使用我的第一个建议(选中如果为空则隐藏选项以隐藏不需要的子报表)。它不会很漂亮(大量空白),但它可以完成工作。

Your question is perfectly reasonable, but I'm pretty sure that in CR-XI, there is no automatic way to do this. I recommend skipping the cross-tab designer completely and just making your own:

  1. Make a new CR using a placeholder table that has exactly 1 record.
  2. In this CR, suppress everything but the details section. Add a new details section so you will have Da and Db.
  3. In Da, add a subreport. Use your real datasource and add Column1 and Column2.
  4. In Db, add a subreport. Use your real datasource and add Column3 and Column4.

I don't have time to test this, but I think it will display all the columns as you requested.

(Instead of step 1, you can probably use a placegrouper group in your report that only has 1 group. Then, when you add the subreports, make sure to not add any links to the main report.)

Edit

A dynamic number of columns makes this request much more difficult to do in Crystal.

  1. Maybe you could autogenerate the entire report from a script. I couldn't help you with that, but I'm sure someone else on StackOverflow will.

  2. You can use MS Excel to achieve something similar. Use MS Access or something similar to set up a crosstab of your data. Open a new Excel workbook and import your crosstabbed datasource using Data->Import External Data->Import Data (this imports the entire table, regardless of number of rows). In Page Setup, change settings to Fit to (blank) pages wide by 1 pages tall. You can format the data however you like and the format will be retained. This Excel method will squeeze all your columns into a 1-page wide area. It's not quite what you're asking for, but it will work.

  3. The number of columns may be dynamic, but do you know what the field names could be? For example, your columns include 0-50 US States, then you know what the column names will be, just not which ones or how many. If this is your situation, then use my first suggestion (check off the suppress if blank options to hide unneeded subreports). It won't be pretty (alot of white space), but it can get the job done.

梦途 2024-10-05 16:27:01

一个可能的解决方案是多列报告。但将行标签和值放在同一行可能很困难。

如果您可以创建额外的行分组,那么您就拥有了您想要的解决方案。例如,如果您的列具有与示例中类似的数字。然后您可以添加如下公式:

columnId \ 2

A possible solution can be a multi column report. But it can be difficult to make the row labels and values in the same line.

If you can create an additional row grouping then you have the solution that you want. For example if your columns have number like in your sample. Then you can add a formula like:

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