1

我是一个 BIRT 新手,我真的可以用一只手来做。

一些背景:

我正在开发一些软件,允许在数据中心显示和简单建模第 1 层连接。

这是基于 Java 的,在 Tomcat 上运行,使用 BIRT 报告。BIRT 从我们已实现的通用 Web 服务中获取数据,将数据作为 XML 提供,BIRT 使用 SOAP 获取数据。

我正在处理的报告目前正在查询我们的系统,以找出设备上特定端口上的电路跟踪。

对此的简单报告可以正常工作。它提供了资产的祖先路径,然后是特定的资产和端口。

例如,资产 ID 49345,端口 1 会生成一个看起来(有点)像这样的报告......

Organization >> Comms Room >> Comms Room Cabinet 02 Rack 01 >> Comms Room C02 R01 Telephone Patch Panel       P1 - B1
Organization >> Comms Room >> Comms Room Cabinet 02 Rack 01 >> Comms Room C02 R01 Patch Panel 02              P2 - B2
Organization >> Client/Server development >> U1 ClntSvr FB 02 >> U1 ClntSvr FB 02 I4                          P2 - B2

这表示电话接线板的背面通过跳线连接到另一个面板,再到该面板的背面,再到地板盒的背面。

这份报告工作得相当愉快。

一位客户想要更多!

他们希望从 BIT 报告中导出的 Excel 是可过滤的,即他们需要以列表形式而不是有分隔的祖先路径,因此当它导出到 Excel 时,每个条目都在不同的列上。

我修改了我的查询以返回一个祖先元素数组而不是单个字符串,并且以它自己的方式,这也有效。

此新查询的 SOAP 响应如下(仅供参考 - 它可能会有所帮助)

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <SOAP-ENV:Body>
      <FindCircuitByAssetAndPortResponse>
         <CircuitDetail>
            <FoundByAsset>Comms Room C02 R01 Telephone Patch Panel (id: 49345)</FoundByAsset>
            <FoundByPort>P1</FoundByPort>
            <CircuitAssetDetail>
               <AssetId>49345</AssetId>
               <AncestryPath>Organization >> Comms Room >> Comms Room Cabinet 02 Rack 01 >> Comms Room C02 R01 Telephone Patch Panel</AncestryPath>
               <AncestryPathList>
                  <AncestryPathElement>Organization</AncestryPathElement>
                  <AncestryPathElement>Comms Room</AncestryPathElement>
                  <AncestryPathElement>Comms Room Cabinet 02 Rack 01</AncestryPathElement>
                  <AncestryPathElement>Comms Room C02 R01 Telephone Patch Panel</AncestryPathElement>
               </AncestryPathList>
               <AssetTypeName>Patch Panel</AssetTypeName>
               <InPort>B1</InPort>
               <OutPort>P1</OutPort>
            </CircuitAssetDetail>
            <CircuitAssetDetail>
               <AssetId>49339</AssetId>
               <AncestryPath>Organization >> Comms Room >> Comms Room Cabinet 02 Rack 01 >> Comms Room C02 R01 Patch Panel 02</AncestryPath>
               <AncestryPathList>
                  <AncestryPathElement>Organization</AncestryPathElement>
                  <AncestryPathElement>Comms Room</AncestryPathElement>
                  <AncestryPathElement>Comms Room Cabinet 02 Rack 01</AncestryPathElement>
                  <AncestryPathElement>Comms Room C02 R01 Patch Panel 02</AncestryPathElement>
               </AncestryPathList>
               <AssetTypeName>Patch Panel</AssetTypeName>
               <InPort>P2</InPort>
               <OutPort>B2</OutPort>
            </CircuitAssetDetail>
            <CircuitAssetDetail>
               <AssetId>48634</AssetId>
               <AncestryPath>Organization >>  Client/Server development >> U1 ClntSvr FB 02 >> U1 ClntSvr FB 02 I4</AncestryPath>
               <AncestryPathList>
                  <AncestryPathElement>Organization</AncestryPathElement>
                  <AncestryPathElement>Client/Server development</AncestryPathElement>
                  <AncestryPathElement>U1 ClntSvr FB 02</AncestryPathElement>
                  <AncestryPathElement>U1 ClntSvr FB 02 I4</AncestryPathElement>
               </AncestryPathList>
               <AssetTypeName>Module</AssetTypeName>
               <InPort>P2</InPort>
               <OutPort>B2</OutPort>
            </CircuitAssetDetail>
         </CircuitDetail>
      </FindCircuitByAssetAndPortResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

报表数据集使用最深层,即祖先元素。

但是,当它显示数据时,会有重复的数据。例如,上面的数据现在显示为...

Organization                             B1 - P1
Comms Room                               B1 - P1
Comms Room Cabinet 02 Rack 01            B1 - P1
Comms Room C02 R01 Telephone Patch Panel B1 - P1
Organization                             P2 - B2
Comms Room                               P2 - B2
Comms Room Cabinet 02 Rack 01            P2 - B2
Comms Room C02 R01 Patch Panel 02        P2 - B2
Organization                             P2 - B2
Client/Server development                P2 - B2
U1 ClntSvr FB 02                         P2 - B2
U1 ClntSvr FB 02 I4                      P2 - B2

这是“正确的”,因为我们通过 XML 取回了 12 个“行”。列映射表示元素是“当前”数据,端口(P1 和 B1)“向上”一层,依此类推。

如果我获取与祖先路径列表相关的数据,我们不会得到重复的数据,但此时,祖先路径列表不会被视为列表,因此要么什么都不显示,要么只显示第一个元素从列表中重复,导致...

Organization B1 - P1
Organization
Organization
Organization
Organization P2 - B2
Organization
Organization
Organization
Organization P2 - B2
Organization
Organization
Organization

我 99% 确信 BIRT 会做我需要的,但我是新手,我很惊讶我已经做到了!

这个问题是非特定的,因为我们在其他情况下可能需要获取列表列表。

如果这已经被覆盖,我很抱歉。我看过,但它可能列在我不熟悉的术语下。

非常感谢。

皮特。

4

1 回答 1

0

如果你想要这样的输出

Organization                             B1 - P1
Comms Room                               
Comms Room Cabinet 02 Rack 01           
Comms Room C02 R01 Telephone Patch Panel 
Organization                             P2 - B2
Comms Room                               
Comms Room Cabinet 02 Rack 01            
Comms Room C02 R01 Patch Panel 02        
Organization                            
Client/Server development                
U1 ClntSvr FB 02                        
U1 ClntSvr FB 02 I4  

在 BIRT 中,有一个选项要求GROUP您执行此操作,即
选择表,您将在其中看到属性对话框,group options在该选项中,它将列出查询的列名,您可以选择自己的列分组
查看本教程进行分组

于 2013-05-30T12:27:59.067 回答