天天看點

pentaho report-designer 報表中添加相應的超連結及傳參pentaho report-designer 報表中添加相應的超連結及傳參

pentaho report-designer 報表中添加相應的超連結及傳參

以前都是自己學習技術,自己做筆記都是自己看,最近有點想寫部落格,這是我第一篇部落格。後續會将自己學習大資料的筆記及工作中遇到的問題也通過部落格發出來。

使用pentaho做報表設計,而且需要在報表中使用超連結并可以傳參。這幾天在網上一直找相關的資料,但是發現基本沒有,于是自己摸索。最後終于找到了實作方式。希望對剛學pentaho的同學有幫助(本文不對pentaho的搭建做說明)

注:如果有疏漏或錯誤的地方,請大家多多指教,謝謝

需要解決的問題:生成資料清單頁和資料行的明細頁——報表中添加相應的超連結

資料表:

表名:sale
字段:
saleId
cusId
unpiprice

第一步:建立一個報表

1.1 建立報表,  

pentaho report-designer 報表中添加相應的超連結及傳參pentaho report-designer 報表中添加相應的超連結及傳參

1.2 設定查詢sql為:select * from sale where saleId = ${saleID} and cusId= ${cusID}

pentaho report-designer 報表中添加相應的超連結及傳參pentaho report-designer 報表中添加相應的超連結及傳參

1.3 設計報表

pentaho report-designer 報表中添加相應的超連結及傳參pentaho report-designer 報表中添加相應的超連結及傳參

1.4 添加參數:saleID,cusID

pentaho report-designer 報表中添加相應的超連結及傳參pentaho report-designer 報表中添加相應的超連結及傳參
pentaho report-designer 報表中添加相應的超連結及傳參pentaho report-designer 報表中添加相應的超連結及傳參
pentaho report-designer 報表中添加相應的超連結及傳參pentaho report-designer 報表中添加相應的超連結及傳參

1.5 釋出

pentaho report-designer 報表中添加相應的超連結及傳參pentaho report-designer 報表中添加相應的超連結及傳參

擷取目前頁面的url:http://localhost:8080/pentaho/api/repos/%3A%E8%BF%9E%E6%8E%A54.prpt/viewer

第二步:建立另一個報表

2.1 建立報表

2.2 設定查詢sql為:select saleId,cusId from sale where saleId(步驟同上)

2.3 設計報表

pentaho report-designer 報表中添加相應的超連結及傳參pentaho report-designer 報表中添加相應的超連結及傳參

2.4 設計超連結

右擊 Details 中的 saleId,選擇 HyperLink

pentaho report-designer 報表中添加相應的超連結及傳參pentaho report-designer 報表中添加相應的超連結及傳參

選擇 Location --> Manual Linking

pentaho report-designer 報表中添加相應的超連結及傳參pentaho report-designer 報表中添加相應的超連結及傳參

在Formula 填寫以下内容:

=DRILLDOWN("generic-url"; "http://localhost:8080/pentaho/api/repos/%3A%E8%BF%9E%E6%8E%A54.prpt/viewer"; {"saleID"; [saleId] | "cusID"; [cusId]})

注意格式為:=DRILLDOWN("generic-url";"需要連結的url(第一個報表的url)";{"參數名稱()";[傳參字段名] |"參數名稱()";[傳參字段名]})

2.5 釋出改報表(操作同上)

第三步:web檢視

點選 saleId 欄的數值。便可以連接配接到第一個報表中。

pentaho report-designer 報表中添加相應的超連結及傳參pentaho report-designer 報表中添加相應的超連結及傳參
pentaho report-designer 報表中添加相應的超連結及傳參pentaho report-designer 報表中添加相應的超連結及傳參

操作結束。

saleId