Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to associate the Chinese text of BIRT with JSON

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces you how to do BIRT Chinese and JSON association, the content is very detailed, interested friends can refer to, I hope to help you.

BIRT provides a solution for Joint DataSet for the union of two data sources. It has a graphical operation interface and can complete simple internal and external associations, but its functions are very limited (almost no secondary calculation ability, re-calculation after Join is limited to simple queries and fixed queries, and it is difficult to realize free combination queries and variable queries, let alone multi-step calculations such as grouping summary and re-filtering).

Although BIRT supports CSV/TXT files as data sources, it cannot build JSON data sources. Some open source communities provide plug-ins for parsing JSON data sources. Almost all plug-ins are very low-level and inconvenient to use.

In terms of ability, only custom data sources can solve this problem completely, but BIRT JAVA bean data source is a complicated hard-coded way with a huge workload.

For example, if you want to deal with such a scenario: sales.txt is a tab-separated structured text, city.json is an unstructured JSON string, and there is a foreign key relationship between the second column of sales.txt and some texts of city.json. You need to join the two files into a two-dimensional table. The schematic diagram is as follows:

It is recommended to use a concentrator, which is an independent data calculation engine, has no database dependent computing power, can obtain data from a variety of files and mix associative operations, in fact, you can think of the concentrator as a simpler syntax BIRT JAVA bean data source. For example, to implement the above problem, the integrator script only needs 5 lines:

A

1

=json(file("/workspace/city.json").read())

2

=A1.new(name,#1. (#1):desc,(firstblank=pos(desc," "),left(desc,firstblank-1)):key,right(desc,len(desc)-firstblank):value)

3

=file("/workspace/sales.txt").import@t()

4

=join(A3:sales,#2;A2:city,key)

5

=A4.new(sales.OrderID,sales.Client,sales.Amount,sales.OrderDate,city.name,city.value)

After association, it is also easier to perform calculations, such as: counting sales in each city; just add 1 line to this: =A5.groups(name;sum(Amount):amount)

About BIRT Chinese text and JSON association how to do to share here, I hope the above content can be of some help to everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report