In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you about the inter-line calculation and subtotals in the BIRT group. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.
BIRT provides a simple function of calculating columns, which can calculate some other column values or statistical values (regular expressions) based on the original data. However, because the model adopts the control drag-and-drop layout (usually naming the data units in the design phase with column names), there is no good post-operation report data item naming mechanism, so it is difficult to accurately describe the reference relationship between the data. as a result, random independent grid operations are very difficult.
For example, to deal with such a scenario: to make the example as simple as possible, suppose there are three columns of data, grouped according to id, and the data format is as follows:
The expected report results are shown in the following figure:
Calculation rules:
1. Newcolumn= previous line v1 + V1 + previous row v2 + v2 (0 if there is no data in the previous row)
2. Each group has a subtotal to summarize the newcolumn
3. Finally, a total is needed.
A common solution is to write custom datasets (complex SQL or scripted data sources) that are calculated beforehand and then crammed into the report grid. But the custom dataset way, the code is very troublesome, the workload is heavy.
It is much easier to use an aggregator. Its rich set operations can easily complete this kind of calculation, which is shorter than scripted data sources code and easier to write than SQL. For example, similar calculations can be written like this in the aggregator:
A
B
one
= myDB.query@x ("select *, 0 as newcolumn from sample")
= create (id,v1,v2,newcolumn)
two
> A1.group (id) .run (~ .run (v1+v2+v1 [- 1] + v2 [- 1]: newcolumn))
three
For A1.group (id)
> B1.insert (0Plux A3Magnum id recorder v1meme v2jue newcolumn)
four
> B1.insert (0, ", A3.id +" SUBTOTAL: ", A3.sum (newcolumn))
five
> B1.insert (0, "TOTAL:", A1.sum (newcolumn))
Finally, the calculation result is returned to BIRT to show the report directly.
The above is the cross-line calculation and subtotal within the group in BIRT shared by the editor. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.