Statistical report generation method and device, computer device and storage medium

By automatically generating text commands through a user interface, the statistical report generation process is simplified, solving the problems of high maintenance costs and low efficiency in traditional methods, and achieving efficient and low-cost report generation.

CN117033386BActive Publication Date: 2025-11-11杜文广
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311039999.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-17
Publication Date
2025-11-11
Estimated Expiration
2043-08-17

AI Technical Summary

Technical Problem

Traditional methods of generating statistical reports are costly and inefficient to maintain. Manual generation by business personnel is inefficient, while automatic generation by IT departments is costly and difficult to communicate.

Method used

This paper provides a method for generating statistical reports. It automatically generates text instructions through a user interface, simplifies the process to the simplest steps, and generates complex reports using template record sets and text instructions, avoiding the need for IDE integrated development environments and multi-level nested queries.

Benefits of technology

It reduced maintenance costs, improved operational efficiency, simplified the understanding of business logic, and reduced communication costs for technical personnel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117033386B_ABST
    Figure CN117033386B_ABST
Patent Text Reader

Abstract

This application relates to a method, apparatus, computer device, and storage medium for generating statistical reports. The statistical report generation method automatically generates text instructions based on the user-selected database, selected table name, content in the keyword text field, content in the relation field, and content in the command field. Simultaneously, it sequentially reads and executes the text instructions in the instruction table. This eliminates the need for an IDE (Integrated Development Environment), temporary intermediate tables, and complex SQL instructions with multi-level nested subqueries. Each step is simplified into the simplest instructions, stored as text in the instruction table, making future changes, maintenance, and expansion very convenient. During execution, the "generate report" function sequentially reads the text instructions in the table, concatenates the results of each step into the report, and finally generates a complex report, effectively reducing maintenance costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of basic data statistics technology, and in particular to a statistical report generation method, apparatus, computer equipment, and storage medium. Background Technology

[0002] Creating statistical reports is an indispensable part of business management. Basic data is used daily to generate these reports in order to understand the business situation. Currently, internally, companies typically either have their IT departments use database technology to develop applications to automatically generate statistical reports, or business personnel manually create them.

[0003] The inventors discovered that traditional technologies suffer from high maintenance costs and low efficiency. Summary of the Invention

[0004] Therefore, it is necessary to provide a statistical report generation method, apparatus, computer equipment, and storage medium to address the aforementioned technical problems.

[0005] On the one hand, this application provides a method for generating statistical reports, including:

[0006] Upon receiving a database selected by the user, the table names of the selected database are loaded into the drop-down options of the first and second table columns.

[0007] Upon receiving the table name selected by the user in the first or second column, display the field names and primary key field names of the selected table name in the field name field of the first or second column.

[0008] In response to the field name insertion operation, the selected field name is displayed in the keyword text bar;

[0009] In response to a selection operation in the relationship bar, the user-selected relationship type is displayed in the relationship bar; in response to a selection operation in the command bar or a command bar definition, the user-selected command type is displayed in the command bar.

[0010] In response to the synthesis command, a text command is generated based on the selected database, the selected table name, the content in the keyword text field, the content in the relation field, and the content in the command field.

[0011] In response to the execution command, the text command is executed and the results are returned; the results include the query result record set and / or the number of affected records;

[0012] In response to the instruction to be added to the instruction list, the text instruction that has been executed without error is saved to the instruction list; where "execution without error" is determined based on the result.

[0013] Read and execute the text instructions in the instruction table sequentially to obtain statistical reports.

[0014] The above-described statistical report generation method automatically generates text commands based on the user-selected database, table name, keyword text field, relation field, and command field. It sequentially reads and executes the text commands in the command table, eliminating the need for an IDE, temporary intermediate tables, or complex SQL commands with nested subqueries. Each step is simplified into the simplest commands, stored as text in the command table, making future changes, maintenance, and expansion very convenient. During execution, the "Generate Report" function sequentially reads the text commands in the table, concatenates the results of each step into the report, and finally generates a complex report, effectively reducing maintenance costs.

[0015] In one embodiment, the step of obtaining a statistical report includes:

[0016] Link the template file and obtain the template record set based on the template file and the read text instructions;

[0017] Disconnect from the template recordset and clear the template recordset to obtain a blank template recordset including column header data;

[0018] Read text instructions and generate an initial record set based on the text instructions; wherein, the initial record set includes row header data;

[0019] Insert the initial recordset into the blank template recordset to obtain a template recordset that includes column header data and row header data;

[0020] Select the record set of any statistical item, and match the data of the record set of any statistical item with the column header data and row header data to obtain the corresponding matching position and fill it in, until the data filling operation of all statistical items is completed;

[0021] Paste the template record set into the template file to obtain the statistical report.

[0022] In one embodiment, the step of loading the table names of the selected database into the first and second table columns includes:

[0023] Establish a connection with the selected database;

[0024] Read the structure information file of the selected database to obtain the table names of the selected database;

[0025] Load the table names of the selected database into the drop-down options of the first and second table columns.

[0026] In one embodiment, the step of displaying the field names and primary key field names of the selected table name in the field name field of the first table column or the field name field of the second table column includes:

[0027] Obtain the field names and primary key field names corresponding to the selected table name from the selected database structure information file;

[0028] The field names and primary key field names corresponding to the selected table name will be listed in the field name column of the first table column or the field name column of the second table column.

[0029] In one embodiment, the step of generating text instructions includes:

[0030] The parameters are passed to the synthesis function and returned as text instructions; the parameters include: the selected database, the selected table name, the content of the keyword text field, the content of the command field, and the content of the relationship field.

[0031] In one embodiment, the keyword text field includes a Select text field, a Where text field, a GroupBy text field, an OrderBy text field, and an On text field.

[0032] On the one hand, this application also provides a statistical report generation device, including:

[0033] The table name loading module is used to load the table names of the selected database into the drop-down options of the first and second table columns when the user selects a database.

[0034] The field name display module is used to receive the table name selected by the user in the first or second column, and display the field name and primary key field name of the selected table name in the field name column of the first column or the field name column of the second column.

[0035] The keyword text bar module is used to display the selected field name in the keyword text bar in response to the field name insertion operation;

[0036] The Relationships module is used to respond to the selection operation in the Relationships panel and display the type of relationship selected by the user in the Relationships panel;

[0037] The command bar module is used to display the user-selected command type in the command bar in response to the selection operation of manipulating or defining the command bar; the composition module is used to generate text commands in response to composition instructions based on the selected database, the selected table name, the content in the keyword text field, the content in the relation field, and the content in the command bar.

[0038] The execution module is used to execute the text instruction in response to the execution command and return the result; wherein the result includes the query result record set and / or the number of affected records;

[0039] The Add Instruction List module is used to save the text instructions that have been executed without error to the instruction list in response to the Add to Instruction List instruction; where "execution without error" is determined based on the result.

[0040] The report generation module is used to read and execute text commands in the instruction table sequentially to generate statistical reports.

[0041] In one embodiment, the report generation module includes:

[0042] The linking module is used to link template files and obtain template record sets based on the template files and the read text instructions;

[0043] The Clear module is used to disconnect from the template recordset and clear the template recordset to obtain a blank template recordset for column header data;

[0044] The read module is used to read text commands and generate an initial record set based on the text commands; the initial record set includes column header data;

[0045] The insert module is used to insert the initial recordset into the blank template recordset to obtain a template recordset that includes column header data and row header data;

[0046] The data entry module is used to select the record set of any statistical item, match the data of the record set of any statistical item with the column header data and row header data, obtain the corresponding matching position and fill it in, until the data entry operation of all statistical items is completed.

[0047] The paste module is used to paste template record sets into a template file to generate statistical reports.

[0048] On the one hand, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the above method.

[0049] On the other hand, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method. Attached Figure Description

[0050] To more clearly illustrate the technical solutions in the embodiments of this application or the conventional technology, the drawings used in the description of the embodiments or the conventional technology will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0051] Figure 1 This is a schematic flowchart of a statistical report generation method in one embodiment;

[0052] Figure 2 This is a schematic flowchart illustrating the steps for obtaining a statistical report in one embodiment;

[0053] Figure 3 This is a schematic flowchart illustrating the steps of loading the table name of the selected database into the drop-down options of the first table column and the drop-down options of the second table column in one embodiment.

[0054] Figure 4 This is a structural block diagram of a statistical report generation device in one embodiment. Detailed Implementation

[0055] To facilitate understanding of this application, a more complete description will be provided below with reference to the accompanying drawings, which illustrate embodiments of the present application. However, the present application can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that the disclosure of this application will be thorough and complete.

[0056] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.

[0057] When used herein, the singular forms of “a,” “an,” and “the” may also include the plural forms unless the context clearly indicates otherwise. It should also be understood that the terms “comprising,” “including,” or “having,” etc., specify the presence of the stated feature, whole, step, operation, component, part, or combination thereof, but do not preclude the possibility of the presence or addition of one or more other features, wholes, steps, operations, components, parts, or combinations thereof.

[0058] Currently, there are two models for creating statistical reports:

[0059] The first approach involves business personnel manually creating statistical reports using Excel (WPS) spreadsheets, relying on formulas, functions, and arrays. The drawbacks of this approach are that it requires extensive training to master, data processing is limited to looping through cells (arrays) by index, it cannot directly express business logic, resulting in low efficiency and difficulties in understanding and maintaining the business logic later on.

[0060] The second model involves the IT department developing an application to automatically generate statistical reports, using database technology. Its drawbacks include the need for manual input, requiring specialized knowledge and a high technical threshold. It can only be developed by technical professionals, who often struggle to grasp the business logic, leading to high communication costs with business personnel. Another disadvantage is that business operations frequently change, requiring corresponding updates to the statistical reports. This necessitates keeping technical personnel updated to adapt to the evolving business logic, resulting in high costs for subsequent report modifications and maintenance.

[0061] The statistical report generation method proposed in this application can effectively solve the above problems.

[0062] In one embodiment, such as Figure 1 As shown, a method for generating statistical reports is provided, including:

[0063] S110, upon receiving the database selected by the user, load the table name of the selected database into the drop-down options of the first table column and the drop-down options of the second table column.

[0064] The database can be Access, SQLite, MySQL, Oracle, etc., and the user can select a database from these. The first and second column display the table names of the selected database to facilitate further selection by the user. That is, when a database is selected by the user, the names of all tables in the selected database are loaded into the drop-down options of the first and second column. This allows the user to select the table they wish to operate on from these two column options. The first column can be referred to as the T column, and the second column as the F column.

[0065] S120, Receive the table name selected by the user in the first column or the second column, and display the field name and primary key field name of the selected table name in the field name field of the first column or the field name field of the second column.

[0066] Specifically, when a user selects a table name in the first or second table column, the field names and primary key field names of the selected table are displayed in the field name column of the first or second table column. This allows the user to see the field names of the selected table for further operation. In one embodiment, the step of displaying the field names of the selected table in the field name column of the first or second table column includes: obtaining the field names and primary key field names corresponding to the selected table name from the structure information file of the selected database; and listing the field names and primary key field names corresponding to the selected table name in the field name column of the first or second table column. A primary key field name is a special field in a database table used to uniquely identify each row of data in the table. The value of a primary key field must be unique within the table, meaning that duplicate values ​​are not allowed in the primary key field, which helps the database system quickly find, update, and delete specific data rows in the table.

[0067] S130, in response to the field name insertion operation, display the field name selected by the user in the keyword text bar;

[0068] The keyword text fields include the Select text field, the Where text field, the GroupBy text field, the OrderBy text field, and the On text field.

[0069] The Select text field is an input box or text area in a user interface where users can drag and drop field names to form a SELECT / UPDATE-SET statement, which is then used to execute a database query or update. A SELECT statement is an SQL query statement used to retrieve data from a database table. SELECT statements can filter data based on specified conditions and can select the columns to retrieve. An UPDATE-SET statement is an SQL manipulation statement used to update data in a database table. UPDATE-SET statements can update data based on specified conditions. The WHERE text field is an input box or text area in a user interface where users can enter field names to generate an appropriate WHERE clause, used to specify query / update conditions in a SELECT / UPDATE statement. The WHERE clause filters data in a database table, returning only rows that meet specific conditions. The GROUP BY text field is an input box or text area in a user interface where users can enter field names to generate a GROUP BY clause, used to group the results in a SELECT statement. The GROUP BY clause groups the query results by the values ​​of one or more columns and then performs aggregation calculations on each group. The `ORDER BY` text field is an input box or text area in the user interface where users can enter field names for the `ORDER BY` clause, used to sort query results in a `SELECT` statement. The `ORDER BY` clause sorts query results based on the values ​​of one or more columns, allowing for ascending or descending order. The `ON` text field is also an input box or text area in the user interface where users can enter field names to generate the `ON` clause, used to specify the join conditions for a `JOIN` operation in a `SELECT` statement. The `ON` clause joins multiple tables based on common fields, thus linking data together.

[0070] Specifically, users can drag and drop or click to select the corresponding field name from the field name field of the first column or the field name field of the second column and place it into the keyword text field.

[0071] S140, in response to the selection operation in the relationship column, displays the relationship type selected by the user in the relationship column;

[0072] Specifically, the Relationships column is used to display the relationships or connection methods between tables in the database.

[0073] S150, in response to a selection operation that manipulates or defines the command bar, displays the command type selected by the user in the command bar;

[0074] Specifically, the command type can be an SQL command type. SQL commands can be divided into the following types: data query commands, data definition commands, data control commands, and transaction control commands.

[0075] S160, in response to the synthesis command, generates a text command based on the selected database, the selected table name, the content in the keyword text field, the content in the relation field, and the content in the command field.

[0076] Specifically, users can click the "Compose" button to input a composition command. In one embodiment, the step of generating a text command includes: transmitting parameters to the composition function and returning the text command; wherein the parameters include: the selected database, the selected table name, the content of the keyword text field, the content of the relationship field, and the content of the command field.

[0077] S170, in response to the execution instruction, executes the generated text instruction and returns the result; wherein the result includes the result record set or the number of affected records;

[0078] Specifically, users can click the execute button to input execution commands.

[0079] S180, in response to the instruction to add to the instruction list, save the text instructions that have been executed without error to the instruction list; wherein, the execution without error is determined based on the result; S190, read and execute the text instructions in the instruction list in sequence to obtain a statistical report.

[0080] Specifically, you can open the "Instruction List" in the report generator, call the "Generate Report" function, and sequentially read and execute the text instructions in the "Instruction List" to complete the output of the statistical report.

[0081] The above-described statistical report generation method automatically generates text commands based on the user-selected database, table name, keyword text field, relation field, and command field. It then sequentially reads and executes the text commands in the command table. This eliminates the need for an IDE (Integrated Development Environment), temporary intermediate tables, and complex SQL commands with nested subqueries. Each step is simplified into the simplest commands, stored as text in the command table, making future changes, maintenance, and expansion very convenient. During execution, the "Generate Report" function sequentially reads the text commands in the table, appends the results of each step to the report, and finally generates a complex report, effectively reducing maintenance costs.

[0082] In one embodiment, such as Figure 2 As shown, the steps to obtain a statistical report include:

[0083] S210, link the template file, and obtain the template record set based on the template file and the read text instructions;

[0084] Specifically, by linking to the template file through code or program, data is read into memory to generate a recordset. A recordset is a data storage structure in memory, that is, the result set of a database query.

[0085] S220, Disconnect from the template recordset and clear the template recordset to obtain a blank template recordset including column header data;

[0086] Specifically, disconnect the link from the template file, making this recordset an independent recordset. Then, clear the data from the original template recordset to obtain a blank template recordset, preparing for subsequent statistical analysis. It should be noted that this blank template recordset still includes column header data. The column header data consists of the title name for each column.

[0087] S230, Read the text instruction and generate an initial record set based on the text instruction; wherein, the initial record set includes row header data;

[0088] S240, Insert the initial record set into the blank template record set to obtain a template record set including column header data and row header data;

[0089] Specifically, a SELECT statement is used to select a record set from the database to serve as the row header data. This SELECT statement is typically used to select the data containing the row header data and insert it into the first column of the template record set as the table's row header data.

[0090] S250: Select the record set of any statistical item, and match the data of the record set of any statistical item with the column header data and row header data to obtain the corresponding matching position and fill it in, until the data filling operation of all statistical items is completed.

[0091] Specifically, using a method similar to the VLOOKUP function in Excel, the records of the statistical data are selected one by one, and the statistical data is filled into the corresponding positions in the blank records by matching the column header data and row header data.

[0092] S260: Paste the template record set into the template file to obtain the statistical report.

[0093] Specifically, paste the entire template record set back into the template file, update the statistical report data into the original template file, and complete the generation of the statistical report.

[0094] The above method can flexibly process the data in the template file, perform data processing and calculation in memory, and then reflect the calculation results in the template file, thus realizing the generation of statistical reports.

[0095] In one embodiment, such as Figure 3 As shown, the steps for loading the table names of the selected database into the first and second table columns include:

[0096] S310, Establish a connection with the selected database;

[0097] S320: Read the structure information file of the selected database to obtain the table names of the selected database;

[0098] S330, load the table names of the selected database into the drop-down options of the first and second table columns.

[0099] It should be understood that, although Figures 1-3 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figures 1-3 At least some of the steps in the process may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but may be executed at different times. The execution order of these steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least some of the steps or stages in other steps.

[0100] In one embodiment, such as Figure 4 As shown, a statistical report generation device is provided, comprising:

[0101] The table name loading module is used to load the table names of the selected database into the drop-down options of the first and second table columns when the user selects a database.

[0102] The field name display module is used to receive the table name selected by the user in the first or second column, and display the field name and primary key field name of the selected table name in the field name column of the first column or the field name column of the second column.

[0103] The keyword text bar module is used to display the selected field name in the keyword text bar in response to the field name insertion operation;

[0104] The Relationships module is used to respond to the selection operation in the Relationships panel and display the type of relationship selected by the user in the Relationships panel;

[0105] The command bar module is used to display the user-selected command type in the command bar in response to the selection operation of manipulating or defining the command bar; the composition module is used to generate text instructions in response to composition instructions based on the selected database, the selected table name, the content in the keyword text field, the content in the relation field, and the content in the command bar.

[0106] The execution module is used to execute the text instruction in response to the execution command and return the result; wherein the result includes the query result record set and / or the number of affected records;

[0107] The Add Instruction List module is used to save the text instructions that have been executed without error to the instruction list in response to the Add to Instruction List instruction; where "execution without error" is determined based on the result.

[0108] The report generation module is used to read and execute text commands in the instruction table sequentially to generate statistical reports.

[0109] In one embodiment, the report generation module includes:

[0110] The linking module is used to link template files and obtain template record sets based on the template files and the read text instructions;

[0111] The Clear module is used to disconnect from the template recordset and clear the template recordset to obtain a blank template recordset for column header data;

[0112] The reading module is used to read text commands and generate an initial record set based on the text commands; the initial record set includes row header data;

[0113] The insert module is used to insert the initial recordset into the blank template recordset to obtain a template recordset that includes column header data and row header data;

[0114] The data entry module is used to select the record set of any statistical item, match the data of the record set of any statistical item with the column header data and row header data, obtain the corresponding matching position and fill it in, until the data entry operation of all statistical items is completed.

[0115] The paste module is used to paste template record sets into a template file to generate statistical reports.

[0116] Specific limitations regarding the statistical report generation device can be found in the limitations of the statistical report generation method described above, and will not be repeated here. Each module in the aforementioned control device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module. It should be noted that the module division in this embodiment is illustrative and only represents a logical functional division; other division methods may be used in actual implementation.

[0117] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:

[0118] Upon receiving a database selected by the user, the table names of the selected database are loaded into the drop-down options of the first and second table columns.

[0119] Upon receiving the table name selected by the user in the first or second column, display the field names and primary key field names of the selected table name in the field name field of the first or second column.

[0120] In response to the field name insertion operation, the selected field name is displayed in the keyword text bar;

[0121] In response to a selection operation in the relationship bar, the user-selected relationship type is displayed in the relationship bar; in response to a selection operation in the command bar or a command bar definition, the user-selected command type is displayed in the command bar.

[0122] In response to the synthesis command, a text command is generated based on the selected database, the selected table name, the content in the keyword text field, the content in the relation field, and the content in the command field.

[0123] In response to the execution command, the text command is executed and the results are returned; the results include the query result record set and / or the number of affected records;

[0124] In response to the instruction to be added to the instruction list, the text instruction that has been executed without error is saved to the instruction list; where "execution without error" is determined based on the result.

[0125] Read and execute the text instructions in the instruction table sequentially to obtain statistical reports.

[0126] In one embodiment, when the processor executes the step of sequentially reading and executing text instructions in the instruction table to obtain a statistical report, it performs the following steps:

[0127] Link the template file and obtain the template record set based on the template file and the read text instructions;

[0128] Disconnect from the template recordset and clear the template recordset to obtain a blank template recordset including column header data;

[0129] Read text instructions and generate an initial record set based on the text instructions; wherein, the initial record set includes row header data;

[0130] Insert the initial recordset into the blank template recordset to obtain a template recordset that includes column header data and row header data;

[0131] Select the record set of any statistical item, and match the data of the record set of any statistical item with the column header data and row header data to obtain the corresponding matching position and fill it in, until the data filling operation of all statistical items is completed;

[0132] Paste the template record set into the template file to obtain the statistical report.

[0133] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0134] Upon receiving a database selected by the user, the table names of the selected database are loaded into the drop-down options of the first and second table columns.

[0135] Upon receiving the table name selected by the user in the first or second column, display the field names and primary key field names of the selected table name in the field name field of the first or second column.

[0136] In response to the field name insertion operation, the selected field name is displayed in the keyword text bar;

[0137] In response to a selection operation in the relationship bar, the user-selected relationship type is displayed in the relationship bar; in response to a selection operation in the command bar or a command bar definition, the user-selected command type is displayed in the command bar.

[0138] In response to the synthesis command, a text command is generated based on the selected database, the selected table name, the content in the keyword text field, the content in the relation field, and the content in the command field.

[0139] In response to the execution command, the text command is executed and the results are returned; the results include the query result record set and / or the number of affected records;

[0140] In response to the instruction to be added to the instruction list, the text instruction that has been executed without error is saved to the instruction list; where "execution without error" is determined based on the result.

[0141] Read and execute the text instructions in the instruction table sequentially to obtain statistical reports.

[0142] In one embodiment, when the processor executes the step of sequentially reading and executing text instructions in the instruction table to obtain a statistical report, it implements the following steps:

[0143] Link the template file and obtain the template record set based on the template file and the read text instructions;

[0144] Disconnect from the template recordset and clear the template recordset to obtain a blank template recordset including column header data;

[0145] Read text instructions and generate an initial record set based on the text instructions; wherein, the initial record set includes row header data;

[0146] Insert the initial recordset into the blank template recordset to obtain a template recordset that includes column header data and row header data;

[0147] Select the record set of any statistical item, and match the data of the record set of any statistical item with the column header data and row header data to obtain the corresponding matching position and fill it in, until the data filling operation of all statistical items is completed;

[0148] Paste the template record set into the template file to obtain the statistical report.

[0149] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0150] For software implementation, the techniques described herein can be implemented by units that perform the functions described herein. The software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.

[0151] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0152] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0153] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0154] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0155] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0156] If the aforementioned function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks. It should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. In the absence of further restrictions, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0157] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for generating statistical reports, characterized in that, include: Upon receiving a database selected by the user, the table names of the selected database are loaded into the drop-down options of the first table column and the drop-down options of the second table column. Upon receiving the table name selected by the user in the first table column or the second table column, the field names and primary key field names of the selected table name are displayed in the field name column of the first table column or the field name column of the second table column. In response to the field name insertion operation, the selected field name is displayed in the keyword text bar; In response to the selection operation in the relationship bar, the user-selected relationship type is displayed in the relationship bar; In response to the selection operation of manipulating or defining the command bar, the user-selected command type is displayed in the command bar; In response to the synthesis command, a text command is generated based on the selected database, the selected table name, the content in the keyword text field, the content in the relationship field, and the content in the command field; In response to the execution instruction, the text instruction is executed and the result is returned; wherein the result includes the query result record set and / or the number of affected records; In response to the instruction to add to the instruction list, the text instruction that has been executed without error is saved to the instruction list; wherein, the execution without error is determined based on the result; The text instructions in the instruction table are read and executed sequentially to obtain a statistical report; wherein, the steps for obtaining the statistical report include: Link the template file, and obtain the template record set based on the template file and the read text instructions; Disconnect from the template record set and clear the template record set to obtain a blank template record set including column header data; Read text instructions and generate an initial record set according to the text instructions; wherein, the initial record set includes row header data; insert the initial record set into the blank template record set to obtain a template record set including the column header data and the row header data; Select the record set of any statistical item, and match the data of the record set of the statistical item with the column header data and the row header data to obtain the corresponding matching position and fill it in, until the data filling operation of all statistical items is completed; Paste the template record set into the template file to obtain a statistical report.

2. The statistical report generation method according to claim 1, characterized in that, The step of loading the table names of the selected database into the drop-down options of the first table column and the drop-down options of the second table column includes: Establish a link with the selected database; Read the structure information file of the selected database to obtain the table names of the selected database; The table names of the selected database are loaded into the drop-down options of the first table column and the second table column.

3. The statistical report generation method according to claim 1, characterized in that, The step of displaying the field names and primary key field names of the selected table name in the field name field of the first table column or the field name field of the second table column includes: Obtain the field names and primary key field names corresponding to the selected table name from the structure information file of the selected database; The field names and primary key field names corresponding to the selected table name are listed in the field name column of the first table column or the field name column of the second table column.

4. The statistical report generation method according to claim 1, characterized in that, The steps for generating text instructions include: The parameters are passed to the synthesis function and the text instruction is returned; wherein the parameters include the selected database, the selected table name, the content of the keyword text field, the content of the command field, and the content of the relationship field.

5. The statistical report generation method according to claim 4, characterized in that, The keyword text fields include Select text field, Where text field, GroupBy text field, OrderBy text field, and On text field.

6. A statistical report generation device, characterized in that, include: The table name loading module is used to load the table name of the selected database into the drop-down options of the first table column and the drop-down options of the second table column when the database selected by the user is received. The field name display module is used to receive the table name selected by the user in the first table column or the second table column, and display the field name and primary key field name of the selected table name in the field name column of the first table column or the field name column of the second table column. The keyword text bar module is used to display the selected field name in the keyword text bar in response to the field name insertion operation; The Relationships module is used to respond to the selection operation in the Relationships panel and display the type of relationship selected by the user in the Relationships panel; The command bar module is used to display the user-selected command type in the command bar in response to the selection operation of manipulating or defining the command bar; the composition module is used to generate text instructions in response to composition instructions based on the selected database, the selected table name, the content in the keyword text bar, the content in the relationship bar, and the content in the command bar. An execution module is used to execute the text instruction in response to an execution instruction and return a result; wherein the result includes a query result record set and / or the number of affected records; an add instruction table module is used to save the text instruction that has been executed without error to the instruction table in response to an add to instruction table instruction; wherein the execution without error is determined based on the result; The report generation module is used to sequentially read and execute the text instructions in the instruction table to obtain statistical reports; The report generation module includes: The linking module is used to link template files and obtain a template record set based on the template files and the read text instructions; The clear module is used to disconnect the link from the template record set and clear the template record set to obtain a blank template record set of column header data; A reading module is used to read text instructions and generate an initial record set based on the text instructions; wherein, the initial record set includes line header data; An insertion module is used to insert the initial record set into the blank template record set to obtain a template record set including column header data and row header data; The data entry module is used to select the record set of any statistical item, and match the data of the record set of the statistical item with the column header data and the row header data to obtain the corresponding matching position and fill it in, until the data entry operation of all statistical items is completed. The paste module is used to paste the template record set into the template file to obtain a statistical report.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 4.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Report generating method and system

    CN107608951A

  • Report generation method and device based on big data, electronic device and storage medium

    CN109344374A