Crystal reports 跨不同页面的Crystal Reports报告格式

Crystal reports 跨不同页面的Crystal Reports报告格式,crystal-reports,formatting,Crystal Reports,Formatting,我有一个关于水晶报告的问题。我有一个现有的报表,其数据取自存储过程。数据可能如下所示: Division|Group Level 1|Group Level 2 |Group Level 3|Value --------+-------------+-------------------+-------------+-------- IT |Assets |Current Asset |Cash |100 CORP |Assets

我有一个关于水晶报告的问题。我有一个现有的报表,其数据取自存储过程。数据可能如下所示:

Division|Group Level 1|Group Level 2 |Group Level 3|Value --------+-------------+-------------------+-------------+-------- IT |Assets |Current Asset |Cash |100 CORP |Assets |Current Asset |Cash |200 IT |Assets |Current Asset |Receivables |300 CORP |Assets |Current Asset |Receivables |400 IT |Assets |Fixed Asset |Land |500 CORP |Assets |Fixed Asset |Land |600 IT |Liabilities |Current Liabilities|Wages |100 CORP |Liabilities |Current Liabilities|Wages |200 IT |Liabilities |Current Liabilities|Taxes |100 CORP |Liabilities |Current Liabilities|Taxes |100 IT |Liabilities |Long-Term |Bonds |300 CORP |Liabilities |Long-Term |Bonds |400 部门|集团1级|集团2级|集团3级|值 --------+-------------+-------------------+-------------+-------- IT |资产|流动资产|现金| 100 公司|资产|流动资产|现金| 200 IT |资产|流动资产|应收账款| 300 公司|资产|流动资产|应收账款| 400 IT |资产|固定资产|土地| 500 公司|资产|固定资产|土地| 600 IT |负债|流动负债|工资| 100 公司|负债|流动负债|工资| 200 IT |负债|流动负债|税收| 100 公司|负债|流动负债|税收| 100 IT |负债|长期|债券| 300 公司|负债|长期|债券| 400 实际数据可能有更多的分区(而不仅仅是两个分区)。在新报告中,我希望报告如下所示:

| IT | CORP Current Asset Cash | 100 | 200 Receivables | 300 | 400 Total Current Asset | 400 | 600 Fixed Asset Land | 500 | 600 Total Fixed Asset | 500 | 600 Total Assets | 900 | 1200 Current Liabilities Wages | 100 | 200 Taxes | 100 | 100 Total Current Liabilities | 200 | 300 Long-Term Bonds | 300 | 400 Total Long-Term | 300 | 400 Total Liabilities | 500 | 700 |IT公司 流动资产 现金| 100 | 200 应收账款| 300 | 400 流动资产总额| 400 | 600 固定资产 土地| 500 | 600 固定资产总额| 500 | 600 总资产| 900 | 1200 流动负债 工资| 100 | 200 税款| 100 | 100 流动负债总额| 200 | 300 长期的 债券| 300 | 400 长期总计| 300 | 400 负债总额| 500 | 700 因此,报告将根据部门数量向右扩展。假设一页最多可以容纳10个分区。如果有15个分区,那么第一页将显示分区1到10,第二页将显示11到15。第一页和第二页上显示的项目将是相同的,只是用于不同的分区。分部的数量是灵活的。而且项目也相当多(可能有很多流动资产、负债等)

现在,我尝试在存储过程中进行一些格式化,因此返回的数据如下所示:

Page No | Group Level 1 | Group Level 2 | Group Level 3 | Div 1 | Value 1 | Div 2 | Value 2 --------+---------------+---------------+---------------+-------+---------+-------+-------- 1 | Assets | Current Asset | Cash | IT | 100 | CORP | 200 1 | Assets | Current Asset | Receivables | IT | 300 | CORP | 400 页码|集团1级|集团2级|集团3级|部门1 |值1 |部门2 |值2 --------+---------------+---------------+---------------+-------+---------+-------+-------- 1 |资产|流动资产|现金| IT | 100 |公司| 200 1 |资产|流动资产|应收账款| IT | 300 |公司| 400 等等。 对于第11至15部分,我将页码设置为2。然后在Crystal报告中,我将分组:页码、组级别1、组级别2和组级别3。 因此,Crystal报告将根据页码在页面上显示所有内容

问题在于:
-如果有很多项目,那么它可能不适合一页。例如,假设一页最多可以容纳30行,那么如果我有40行,那么第二页将显示10行。 但我希望第二页仍然显示第11-15部分的前30行,第三页显示第1-10部分的最后10行,第四页显示第11-15部分的最后10行。
-Crystal报告中的运行总计将在组的每次更改时重置。假设我有40项资产。然后在第三页和第四页的40项资产之后,它应该显示资产总额。如何计算运行总数,使其正确显示?(考虑到我不能直接总结,因为第三页和第四页应该显示不同部门的总数)

是否有解决此问题的方法或更好的数据格式化方法


谢谢。

您的具体问题是什么

  • 格式化报告或计算运行总数
  • 执行以下流程

  • 创建一个带有“GroupLevel1”的组,不加上Group1标题
  • 创建一个带有“Grouplevel2”的组,不要加上Group2标题。创建两个文本文件,写上“IT”和“Corp”,并放在报告上
  • 创建一个带有“Grouplevel3”的组,现在取消group3标题
  • 编写一个公式并添加以下代码

    If division=“IT” 然后价值 埃尔索 编写另一个公式并添加以下代码

    如果division=“公司” 然后价值 其他0

  • 将两个forumula放在详细位置,并将摘要添加到所有部分中。同时,将详细部分放在最上面

    为所有组页脚写入所需文本


    这将解决您的问题。

    我建议使用交叉表

    设置:

    • 列:
      Division
    • 行:
      集团级别1
      集团级别2
      集团级别3
    • 汇总字段:
      Value

    您必须试验行分组字段以获得正确的间距。对列的大小也执行同样的操作。

    一般来说,这就是我最终解决问题的方法:

    1. Define how many divisions (NumColumn) to be displayed in a single page.
    2. Create a table to store the mapping of the division. The table has column that stores PageOffset and ColumnNo. PageOffset stores the number of page to be added when displaying a particular division. For example, if there are 15 divisions, and a page can only accommodate 10 divisions, then the first 10 divisions will have `PageOffset = 0` and the last 5 divisions will have `PageOffset = 1`. The ColumnNo is the position of a division in the report column. So first division will have value of 1, second division will have value of 2 and so on. 11th division will have the value of 1, etc.
    3. Create a result table. For each column in the report, we have 2 database field, value and total.
    4. Loop for each record, sorted by the group.
        Select the position of the division from the table in step 2. If `ColumnNo = 1` insert a row in the result table. E.g. for division 1 and 11 it will create rows in result table.
        After that update the row data, based on the position of the division. So for division 1-10 will update the row created by division 1, division 11-15 will update row created by division 11.
    5. Count the number of items in each group and store it into a table.
    6. Define how many rows (RowsInPage) to be displayed in a single page.
    7. Set PageAdd = 0 and RowsLeft = RowsInPage
    8. Loop for each group
        Retrieve the number of rows needed for this group
        Add the page number of each row with PageAdd
        Decrement RowsLeft
        If RowsLeft = 0
            Increment PageAdd
            Set RowsLeft = RowsInPage
        End If
    9. Loop for each group
        Loop from 1 to NumColumn
            Update the total field for each division. This total field value will be put in the report as the running group total for that particular division.
    

    他们两个。我需要格式化报告,使其显示如上所示(第二页可以是第一页的延续,它将显示完全相同的项目,只是它将显示不同部门的数据)。另外,我想知道在这种情况下如何计算总运行量,因为我认为我不能直接使用Crystal Report中的总运行量功能来满足此类情况。使用解决方案编辑我的答案谢谢回复。然而,我认为在实施过程中会有困难。就部门名称和页面中的部门数量而言,部门是动态的。所以我不太相信这样的硬编码会奏效。我想我不能抑制detail部分,因为我还需要显示divi中每个项目的单独值