Run scripts to generate reports of hybrid data sources and reports.
You can use different data sources in the same report, such as RDB, TXT, Excel, JSON, HTTP, Hadoop, and mongodb. If you use a hybrid data source in a computing report that does not rely on third-party programs (such as JAVA), you can use a built-in script (Dataset). The following example shows how to use it.
In the business system, the order information is stored in a JSON file. When querying a report, you must read the JSON file and the database table (dimension table) for joint query. This example describes how to query the customer information of all orders in a certain shipping period.
The content of orders. json is as follows:
The following is the report design process.
Connect to the data source
Connect to the data source in the report designer.
Set Report Parameters
Create a report and set the report parameters (the start and end dates of delivery ).
Set Dataset
In the dataset settings window, select "script dataset" and write scripts to read files and database tables to complete association query.
A1: reads the order information in JSON format;
A2: filter data by date range;
A3: query the database customer table information;
A4: Associate files and data tables based on the customer ID to perform hybrid computing;
A5: Create a result set based on the Association result and return it to the report through A6.
Edit Report expression
Based on the results returned by the script dataset, write the following report expression to complete report creation.
The report results are as follows: