A report condition attribute calculation method and system for automatic identification of a polymerization range

CN122528837APending Publication Date: 2026-08-07NANJING HUADUN ELECTRIC POWER INFORMATION SAFETY EVALUATION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611035473.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-13
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

[0004]针对现有技术无法自动识别条件表达式中聚合函数的作用范围,且在报表动态扩展场景下因即时计算易导致聚合数据集合不完整等问题,本发明提出一种聚合范围自动识别的报表条件属性计算方法及系统

Benefits of technology

[0042] The beneficial effects of this invention are as follows: By encapsulating cell instances configured with conditional attributes as calculation task items and adding them to a delayed calculation queue, the evaluation of conditional expressions is only performed after all cell instances in the entire table have been dynamically expanded and data filled. This fundamentally avoids the problem of incomplete aggregated data sets and inaccurate conditional attribute calculations caused by the incomplete generation of sub-cell instances within the same group in the existing real-time calculation mode, thus ensuring the accuracy of conditional attribute calculations. Simultaneously, during the dynamic expansion process, a row-direction sub-cell mapping table, a column-direction sub-cell mapping table, and a global cell name mapping table are constructed and maintained. This fully records the affiliation of each cell instance in the row and column directions, as well as the complete set of all cell instances under the same cell name. This allows for rapid location of candidate cell instances by simply retrieving the table mappings without traversing the entire report structure when subsequently deriving the aggregation scope, thereby improving the efficiency of aggregation range identification. Furthermore, based on the extended topological relationships of the cell instances recorded in the current calculation task, the system automatically identifies the set of cell instances corresponding to the target cell name referenced by the aggregation function at the corresponding grouping level. This eliminates the need for users to manually write special syntax to declare the aggregation range, fundamentally reducing the learning curve and expression complexity of report condition attribute configuration. It also avoids the drawback of manually specifying static intervals, which struggles to dynamically adapt to changes in data volume. Therefore, from automatic aggregation range identification and condition expression evaluation to custom style application, a complete automated processing chain is formed. Users only need to reference the target cell name and write a regular expression when setting condition attributes; the system can automatically deduce the aggregation calculation range and perform condition judgments, effectively improving the ease of use of report condition attribute configuration and the intelligence level of report generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122528837A_ABST
    Figure CN122528837A_ABST
Patent Text Reader

Abstract

The application discloses a report condition attribute calculation method and system with automatic identification of a polymerization range, and relates to the technical field of report data processing. The method comprises the following steps: in the process of dynamic expansion and data filling of a report cell, encapsulating a cell instance containing a condition attribute into a calculation task item, adding the calculation task item to a delayed calculation queue, and synchronously constructing and maintaining a row and column direction sub-cell mapping table and a global cell name mapping table; after the dynamic expansion and data filling of the whole table cell are completed, traversing the delayed calculation queue, identifying an embedded aggregation function in a condition expression of a cell instance recorded by each calculation task item; based on the expansion topological relationship of the cell instance recorded by the current calculation task item, deducing the scope of the aggregation function, calculating the value of the condition expression, and applying a corresponding custom style to the cell instance recorded by the current calculation task item. The application improves the accuracy and automation degree of condition attribute calculation of a report in a dynamic expansion scenario.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of report data processing technology, and in particular to a method and system for calculating report condition attributes with automatic aggregation range identification. Background Technology

[0002] Reports, as an important data display and analysis tool, are widely used in various information systems. To meet the needs of displaying complex data, report engines typically provide conditional attribute functionality, and allow users to write expressions to describe the logical conditions under which styles take effect. These expressions support cell references, logical operations, comparison operations, and various function calls. Among them, aggregate functions can be used to summarize and calculate cell data within a certain range, and use the summary result as the basis for conditional judgment.

[0003] In existing report generation technologies, when aggregate functions are nested within conditional expressions, report engines typically cannot automatically identify the actual scope of the aggregate function based on the dynamically expanding structure of the report. To address the issue of determining the aggregation scope, existing reporting tools require users to manually add specific syntax markers to declare the scope of aggregation calculations when writing expressions. For example, existing reporting software relies on dedicated delimiters or hierarchy markers to define aggregation intervals, such as using special syntax structures like C2[!0], C2{group}, C2{}, or C2[0]{}. This approach has significant drawbacks: on the one hand, the special syntax rules increase the learning cost for business personnel and the complexity of expression writing, and are prone to calculation errors due to syntax errors; on the other hand, in scenarios where report cells dynamically expand, manually specified static intervals often fail to accurately adapt to dynamically generated grouping levels, and are highly susceptible to incomplete data sets on which aggregation depends due to incorrect range specification or incomplete generation of cell instances under the same group, leading to style calculation errors or condition failures. Summary of the Invention

[0004] To address the shortcomings of existing technologies, such as the inability to automatically identify the scope of aggregate functions in conditional expressions and the potential for incomplete aggregate data sets due to real-time calculations in dynamically expanding reports, this invention proposes a method and system for automatically identifying the aggregation range of report conditional attributes. This method delays the calculation of cell instances configured with conditional attributes during dynamic cell expansion and data filling, while simultaneously constructing a mapping table. After the entire table expansion is complete, the method identifies the aggregate function and automatically derives its scope based on the expansion topology of the cell instances. This achieves automatic identification of the aggregation calculation range and accurate evaluation of conditional expressions, lowering the barrier to expression writing for business personnel and improving the accuracy and automation of conditional attribute calculations in dynamically expanding report scenarios.

[0005] The present invention achieves the above objectives through the following technical solutions:

[0006] A method for calculating report condition attributes with automatic aggregation range recognition, comprising:

[0007] During the dynamic expansion and data filling of report cells, cell instances containing conditional attributes are encapsulated as calculation task items, added to the delayed calculation queue, and row-direction sub-cell mapping tables, column-direction sub-cell mapping tables, and global cell name mapping tables are built and maintained simultaneously.

[0008] After the entire table of cells is dynamically expanded and populated, each calculation task in the delayed calculation queue is traversed sequentially to identify the aggregate function nested in the conditional expression of the cell instance recorded by the calculation task.

[0009] Based on the extended topological relationship of the cell instances recorded in the current calculation task, the aggregation scope of the aggregate function is derived, and the value of the conditional expression is calculated.

[0010] Based on the value of the calculated conditional expression, apply the corresponding custom style to the cell instance recorded for the current calculation task item.

[0011] As a preferred embodiment of the present invention, the aggregate function nested in the conditional expression for identifying the cell instance recorded by the calculation task item includes:

[0012] The conditional expressions of the cell instances recorded in the current calculation task are parsed using a syntax parser, and an abstract syntax tree is constructed.

[0013] Recursively traverse the nodes of the abstract syntax tree to identify aggregate function nodes;

[0014] Extract the parameter information of the aggregate function node to obtain the cell name referenced therein; the parameter information contains the reference expression for the cell name.

[0015] As a preferred embodiment of the present invention, the derivation of the aggregation scope of the aggregation function and the calculation of the value of the conditional expression include:

[0016] Determine the type of the cell expression in the aggregate function, and based on the determination result, obtain the corresponding candidate cell instance list;

[0017] Aggregate calculations are performed based on the list of candidate cell instances, and the conditional expression is evaluated to obtain the value of the conditional expression.

[0018] As a preferred embodiment of the present invention, obtaining the corresponding candidate cell instance list based on the determination result includes:

[0019] If the expression is determined to be a full cell expression, then the corresponding cell instance list is retrieved from the global cell name mapping table using the cell name as the key, and used as the candidate cell instance list.

[0020] If the expression is determined to be a regular cell expression, the search is performed along the left parent cell relationship chain and / or the upper parent cell relationship chain of the cell instance recorded in the current calculation task. Based on the search results, a preset merging strategy is used to determine the final list of candidate cell instances.

[0021] As a preferred embodiment of the present invention, the search is performed along the left parent cell relationship chain of the cell instance recorded in the current calculation task, including:

[0022] Retrieve the left parent cell object of the cell instance recorded in the current calculation task item;

[0023] Check if the left parent cell object is empty. If it is empty, terminate the search and return an empty list. If it is not empty, check if the name of the left parent cell object matches the name of the target cell. If they match, return a list containing the left parent cell object. If they do not match, query the pre-built row-direction child cell mapping table of the left parent cell object, and retrieve the corresponding cell instance list using the name of the target cell as the key. If found, return the cell instance list as a candidate in the row direction. If not found, treat the left parent cell object as the new current traversed cell instance, recursively execute the above search steps, and continue tracing upwards along the left parent cell relationship chain until a match is found or the top of the left parent cell relationship chain is reached, and return an empty list.

[0024] As a preferred embodiment of the present invention, the search is performed along the parent cell relationship chain of the cell instance recorded in the current calculation task item, including:

[0025] Retrieve the parent cell object of the cell instance recorded in the current calculation task item;

[0026] Check if the parent cell object is empty. If it is empty, terminate the search and return an empty list. If it is not empty, check if the name of the parent cell object matches the name of the target cell. If they match, return a list containing the parent cell object. If they do not match, query the pre-built column-direction child cell mapping table of the parent cell object, and retrieve the corresponding cell instance list using the name of the target cell as the key. If found, return the cell instance list as a candidate in the column direction. If not found, treat the parent cell object as the new current traversed cell instance, recursively execute the above search steps, and continue tracing upwards along the parent cell relationship chain until a match is found or the top of the parent cell relationship chain is reached, and return an empty list.

[0027] As a preferred embodiment of the present invention, the step of determining the final list of candidate cell instances based on the search results using a preset merging strategy includes:

[0028] Retrieve the list of target cells to the left along the left parent cell relationship chain and the list of target cells above along the top parent cell relationship chain;

[0029] Based on the existence of the target cell list on the left and the target cell list above, a preset merging strategy is used to determine the final list of candidate cell instances.

[0030] As a preferred embodiment of the present invention, the preset merging strategy includes:

[0031] If the left target cell instance list is not empty and the top target cell instance list is empty, return the left target cell instance list as the final candidate cell instance list;

[0032] If the list of target cell instances above is not empty and the list of target cell instances on the left is empty, return the list of target cell instances above as the final list of candidate cell instances;

[0033] When neither the left-hand target cell instance list nor the top-hand target cell instance list is empty, calculate the intersection of the two lists and return the intersection list as the final candidate cell instance list;

[0034] When both the target cell instance list on the left and the target cell instance list above are empty, retrieve and return the complete list of all cell instances corresponding to the target cell name from the global cell name mapping table.

[0035] As a preferred embodiment of the present invention, it further includes:

[0036] After completing the calculation of all conditional expressions and the application of styles, the original styles of the cell instances and the custom styles are merged to generate a style mapping table for front-end rendering. The style mapping table includes a mapping table of the correspondence between cell coordinates and style identifiers and a mapping table of the correspondence between style identifiers and style definitions.

[0037] A report condition attribute calculation system with automatic aggregation range recognition, comprising:

[0038] The delayed calculation queue management module is used to encapsulate cell instances with conditional attributes as calculation task items and add them to the delayed calculation queue during the dynamic expansion and data filling of report cells. It also synchronously builds and maintains the row direction sub-cell mapping table, the column direction sub-cell mapping table, and the global cell name mapping table.

[0039] The aggregate function recognition module is used to sequentially traverse each calculation task in the delayed calculation queue after the dynamic expansion and data filling of all cells in the table are completed, and identify the aggregate functions nested in the conditional expressions of the cell instances recorded by the calculation task item.

[0040] The aggregation range derivation module is used to deduce the aggregation scope of aggregate functions based on the extended topological relationship of the cell instances recorded in the current calculation task item, and to calculate the value of the conditional expression.

[0041] The Style Application module is used to apply the corresponding custom style to the cell instances recorded by the current calculation task item based on the value of the calculated conditional expression.

[0042] The beneficial effects of this invention are as follows: By encapsulating cell instances configured with conditional attributes as calculation task items and adding them to a delayed calculation queue, the evaluation of conditional expressions is only performed after all cell instances in the entire table have been dynamically expanded and data filled. This fundamentally avoids the problem of incomplete aggregated data sets and inaccurate conditional attribute calculations caused by the incomplete generation of sub-cell instances within the same group in the existing real-time calculation mode, thus ensuring the accuracy of conditional attribute calculations. Simultaneously, during the dynamic expansion process, a row-direction sub-cell mapping table, a column-direction sub-cell mapping table, and a global cell name mapping table are constructed and maintained. This fully records the affiliation of each cell instance in the row and column directions, as well as the complete set of all cell instances under the same cell name. This allows for rapid location of candidate cell instances by simply retrieving the table mappings without traversing the entire report structure when subsequently deriving the aggregation scope, thereby improving the efficiency of aggregation range identification. Furthermore, based on the extended topological relationships of the cell instances recorded in the current calculation task, the system automatically identifies the set of cell instances corresponding to the target cell name referenced by the aggregation function at the corresponding grouping level. This eliminates the need for users to manually write special syntax to declare the aggregation range, fundamentally reducing the learning curve and expression complexity of report condition attribute configuration. It also avoids the drawback of manually specifying static intervals, which struggles to dynamically adapt to changes in data volume. Therefore, from automatic aggregation range identification and condition expression evaluation to custom style application, a complete automated processing chain is formed. Users only need to reference the target cell name and write a regular expression when setting condition attributes; the system can automatically deduce the aggregation calculation range and perform condition judgments, effectively improving the ease of use of report condition attribute configuration and the intelligence level of report generation. Attached Figure Description

[0043] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein: Figure 1 This is a flowchart of a method for calculating report condition attributes that automatically identifies aggregation range, as proposed in this invention. Figure 2 This is a flowchart illustrating the identification of aggregation functions in an embodiment of the present invention; Figure 3 Flowchart for determining the candidate cell instance list in this embodiment of the invention; Figure 4 This is a flowchart illustrating the recursive search along the left parent cell relationship chain in an embodiment of the present invention. Figure 5 This is a flowchart illustrating the recursive search process along the parent cell relationship chain in an embodiment of the present invention. Figure 6 This is a schematic diagram of the modular structure of a report condition attribute calculation system for automatic aggregation range identification proposed in this invention. Detailed Implementation

[0044] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the described embodiments of the present invention are within the scope of protection of the present invention.

[0045] like Figure 1 As shown, this is an embodiment of the present invention, which provides a method for calculating report condition attributes with automatic aggregation range identification, including:

[0046] S1, during the dynamic expansion and data filling of report cells, encapsulates cell instances containing conditional attributes as calculation task items, adds them to the delayed calculation queue, and synchronously builds and maintains row-direction sub-cell mapping tables, column-direction sub-cell mapping tables, and global cell name mapping tables.

[0047] In this article, a cell refers to an abstract cell definition defined during report design, while a cell instance refers to a specific cell with unique coordinates generated after dynamic expansion based on the cell.

[0048] Furthermore, before performing the dynamic expansion and data population process of report cells, this method performs the following preparatory steps to build a complete report runtime environment, as follows:

[0049] Users can perform visual design in the report designer, defining the required dataset, filtering conditions, extended types of each cell, and parent-child relationships between cells. For cells that need to dynamically change their display style based on data, conditional attributes are set and conditional expressions are written, which can include aggregate functions. After the design is completed, the report template containing the above metadata is saved to the database.

[0050] During the report preview or generation stage, the report engine parses the stored report template, extracts the dataset and filtering conditions, dynamically generates and executes SQL queries based on these conditions, and obtains the original dataset, which serves as the basic data source for subsequent cell instance filling and conditional expression calculation.

[0051] The report engine reconstructs the report object model based on the parsed report template. Specifically, it binds the original dataset to the corresponding data area, initializes all cell templates that are not set to dynamically expand and the conditional attributes of each cell template itself; and constructs a parent-child cell hierarchy tree between cells based on the parent-child cell relationships set in the report template, clarifying the parent cell that each dynamically expandable cell depends on when it expands.

[0052] A report context is created based on the reconstructed report template. This report context is used to maintain the global state during the report generation process, including at least global parameters, the current report page number, and the state of the dataset traversal cursor, to ensure consistency of state in each processing stage.

[0053] After completing the aforementioned preliminary steps, this method dynamically expands and populates report cells starting from the root cell, based on the report context and the parent-child cell hierarchy. During this dynamic expansion and data population process, if an immediate calculation mode is used to evaluate the conditional expression, the incomplete data set upon which the aggregation depends, due to the incomplete generation of child cell instances within the same group, will inevitably lead to style calculation errors or condition invalidation. To address this issue, this invention employs a delayed calculation strategy. Whenever a conditional attribute is detected in a dynamically expanded cell instance, the conditional expression for that cell instance is not immediately evaluated. Instead, the unique identifier of the cell instance, the conditional expression, and the current expansion context information are encapsulated into a single calculation task item and uniformly aggregated into a pre-created delayed calculation queue. Processing is then performed only after the global expansion is complete. This delayed calculation queue uses a first-in, first-out (FIFO) queue structure, allowing management based on the order in which calculation task items are added, and also optimizing the subsequent processing order based on the dependencies between cell instances.

[0054] Simultaneously, during the dynamic expansion and data population of the entire table's cells, this method also builds and maintains row-direction sub-cell mapping tables, column-direction sub-cell mapping tables, and a global cell name mapping table to facilitate rapid location of subsequent aggregation scopes. Specifically, the row-direction sub-cell mapping table stores the mapping relationship between each cell instance in the current row direction and its corresponding sub-cell instances in the same row direction; the column-direction sub-cell mapping table stores the mapping relationship between each cell instance in the current column direction and its corresponding sub-cell instances in the same column direction; and the global cell name mapping table stores the mapping relationship between each type of cell name in the report and the list of all cell instances corresponding to that cell name.

[0055] The mapping table described above is dynamically updated as each cell instance is generated, and it fully records the affiliation of each cell instance in the row and column directions, as well as the complete set of all cell instances under the same cell name, thus providing an accurate and efficient retrieval basis for automatically identifying the aggregation range during the delayed calculation stage.

[0056] S2, after the entire table of cells has been dynamically expanded and populated, sequentially traverses each calculation task in the delayed calculation queue and identifies the aggregate function nested in the conditional expression of the cell instance recorded by that calculation task.

[0057] Furthermore, once the report engine confirms that all cells have been dynamically expanded and populated based on the dataset, it triggers the delayed calculation mechanism. At this point, the row-direction sub-cell mapping table, column-direction sub-cell mapping table, and global cell name mapping table constructed in S1 are all complete. The report engine then begins to retrieve each calculation task item from the delayed calculation queue in sequence and performs structured analysis and semantic recognition on the conditional expressions of the cell instances recorded for each calculation task item.

[0058] To accomplish the above analysis and identification, the report engine embeds a syntax parser that supports lexical and syntactic analysis of conditional attribute expressions. This parser can transform complex expression strings into structured tree data structures for programmatic traversal and processing.

[0059] like Figure 2 As shown, the aggregate functions nested in the conditional expression that identifies the cell instance recorded by the calculation task item include:

[0060] S21, use the syntax parser to parse the conditional expressions of the cell instances recorded in the current calculation task item, and construct an abstract syntax tree.

[0061] Furthermore, since conditional expressions are not simply numerical calculations but complex strings containing logical operations, comparison operations, cell references, and aggregate functions (e.g., C1 > AVG(C1)), regular expression matching struggles to accurately extract nested structures and identify the hierarchical relationships between syntactic units. Therefore, this invention employs a parser to perform lexical and syntactic analysis on the conditional expression string, parsing it into an abstract syntax tree. In this abstract syntax tree, leaf nodes represent operands, including constants and cell names, while non-leaf nodes represent operator or function calls. The parent-child relationships between nodes directly reflect the priority and nesting level of operations within the conditional expression.

[0062] S22, recursively traverse the nodes of the abstract syntax tree to identify the aggregate function nodes.

[0063] Furthermore, after constructing the abstract syntax tree, the reporting engine recursively traverses each node in the abstract syntax tree, starting from the root node, using either a depth-first or breadth-first strategy. During the traversal, for each node of function call type, the function name of that function call node is read and compared with a preset aggregate function library. If the function name matches a function in the aggregate function library, the node is marked as an aggregate function node. The preset aggregate function library is a collection of aggregate functions built into the reporting engine, including at least SUM (summation), AVG (average), COUNT (counting), MAX (maximum value), and MIN (minimum value). Because a recursive traversal algorithm is used, even if aggregate functions are nested in the parameter positions of other functions or within multiple layers of expressions, they can be accurately identified layer by layer without omission.

[0064] S23, extract the parameter information of the aggregate function node and obtain the cell name referenced therein.

[0065] Furthermore, for each identified aggregation function node, the report engine extracts the parameter information contained within that node. This parameter information includes a reference expression for a cell name, such as parameter C1 in AVG(C1). The report engine parses this parameter, retrieves the referenced cell name, and records it. These referenced cell names will serve as necessary references for subsequent steps, used to deduce the actual aggregation scope of the aggregation function along the parent-child cell hierarchy, combining the extended topological relationships of the cell instances recorded in the current calculation task and the mapping tables constructed in S1.

[0066] At this point, the calculation task item has been associated with the types of all aggregate functions and the names of the referenced cells within its encapsulated conditional expression, enabling the report engine to accurately locate the scope of the aggregate calculation in S3 based on this information and in conjunction with the extended topology.

[0067] S3, based on the extended topological relationship of the cell instances recorded in the current calculation task, derives the aggregation scope of the aggregate function and calculates the value of the conditional expression.

[0068] Furthermore, after extracting the cell names referenced in the aggregate function in S2, since the report cell template generates multiple cell instances during dynamic expansion, the same cell name may correspond to multiple cell instances located at different grouping levels. Therefore, it is necessary to deduce the correct aggregation scope based on the position of the cell instance recorded by the current calculation task item in the expanded topology. For example... Figure 3 As shown, the details are as follows:

[0069] Determine the type of the cell expression in the aggregate function, and based on the determination result, obtain the corresponding candidate cell instance list.

[0070] Furthermore, the report engine first determines the type of the cell expression in the aggregate function parameters. Cell expressions are divided into two categories: one is a full cell expression, which refers to all cell instances under the given cell name, usually identified by specific syntax markers in the expression, such as C1[*] or ALL(C1); the other is a regular cell expression, which directly references the cell name, indicating that the reference range needs to be determined under the extended topological constraints of the cell instances recorded in the current calculation task, such as C1.

[0071] If the expression is determined to be a full cell expression, then the corresponding list of cell instances is retrieved from the global cell name mapping table, using the cell name as the key, as the candidate cell instance list.

[0072] If the expression is determined to be a regular cell expression, the search is performed along the left parent cell relationship chain and / or the upper parent cell relationship chain of the cell instance recorded in the current calculation task. Based on the search results, a preset merging strategy is used to determine the final list of candidate cell instances.

[0073] Furthermore, the report's expanded topology is defined by parent-child cell relationships, including the left parent cell relationship in horizontal expansion and the upper parent cell relationship in vertical expansion. The position of the cell instance recorded by the current calculation task item in the expanded tree can be located by tracing upwards along the left parent cell relationship chain and along the upper parent cell relationship chain to determine its respective hierarchical grouping container.

[0074] like Figure 4 As shown, when searching along the left parent cell relationship chain of the cell instance recorded in the current calculation task, the following steps are performed:

[0075] Retrieve the left parent cell object of the cell instance recorded in the current calculation task item;

[0076] Check if the left parent cell object is empty. If it is empty, terminate the search and return an empty list. If it is not empty, check if the name of the left parent cell object matches the name of the target cell. If they match, return a list containing the left parent cell object. If they do not match, query the pre-built row-direction child cell mapping table of the left parent cell object, and retrieve the corresponding cell instance list using the name of the target cell as the key. If found, return the cell instance list as a candidate in the row direction. If not found, treat the left parent cell object as the new current traversed cell instance, recursively execute the above search steps, and continue tracing upwards along the left parent cell relationship chain until a match is found or the top of the left parent cell relationship chain is reached, and return an empty list.

[0077] Furthermore, if the left parent cell object is empty, it means the row boundary has been reached; if the name of the left parent cell object matches the name of the target cell, it means the parent cell in the row direction has been found. Finally, a list of left target cell instances found along the left parent cell relationship chain is obtained.

[0078] like Figure 5 As shown, when searching along the parent cell relationship chain of the cell instance recorded in the current calculation task, the following steps are performed:

[0079] Retrieve the parent cell object of the cell instance recorded in the current calculation task item;

[0080] Check if the parent cell object is empty. If it is empty, terminate the search and return an empty list. If it is not empty, check if the name of the parent cell object matches the name of the target cell. If they match, return a list containing the parent cell object. If they do not match, query the pre-built column-direction child cell mapping table of the parent cell object, and retrieve the corresponding cell instance list using the name of the target cell as the key. If found, return the cell instance list as a candidate in the column direction. If not found, treat the parent cell object as the new current traversed cell instance, recursively execute the above search steps, and continue tracing upwards along the parent cell relationship chain until a match is found or the top of the parent cell relationship chain is reached, and return an empty list.

[0081] Furthermore, if the parent cell object is empty, it means the column boundary has been reached; if the name of the parent cell object matches the name of the target cell, it means the parent cell in the column direction has been found. Finally, a list of target cell instances found along the parent cell relationship chain is obtained.

[0082] Based on the search results, a preset merging strategy is used to determine the final list of candidate cell instances, including:

[0083] Retrieve the list of target cells to the left along the left parent cell relationship chain and the list of target cells to the top along the top parent cell relationship chain.

[0084] Based on the existence of the target cell list on the left and the target cell list above, a preset merging strategy is used to determine the final list of candidate cell instances.

[0085] The default merging strategy here is to determine the final scope based on the existence of cell instances found in the row and column directions, either by discarding or taking the intersection. The default merging strategies include:

[0086] If the left-hand target cell instance list is not empty and the top-hand target cell instance list is empty, return the left-hand target cell instance list as the final candidate cell instance list.

[0087] Furthermore, in this case, the aggregation range is controlled only by row-direction grouping or has no column-direction grouping constraints.

[0088] If the list of target cell instances above is not empty and the list of target cell instances on the left is empty, return the list of target cell instances above as the final list of candidate cell instances.

[0089] Furthermore, in this case, the aggregation range is controlled only by column-direction grouping or has no row-direction grouping constraints.

[0090] When neither the left-hand target cell instance list nor the top-hand target cell instance list is empty, calculate the intersection of the two lists and return the intersection list as the final candidate cell instance list.

[0091] Furthermore, in this scenario, the cell instance recorded by the current calculation task is located in a two-dimensional cross-group of rows and columns. By comparing the unique coordinates of the cell instances in the two lists and taking the intersection of the two lists, the cell instance within the cross-group can be accurately located.

[0092] When both the target cell instance list on the left and the target cell instance list above are empty, retrieve and return the complete list of all cell instances corresponding to the target cell name from the global cell name mapping table.

[0093] Furthermore, in this case, if no group affiliation is found along the parent-child cell topology, a fallback strategy of obtaining all instances from the global cell name mapping table is adopted.

[0094] Through the above merging strategy, the report engine can automatically adapt to grouping designs with different expansion directions. Without manually specifying the aggregation range expression, it can accurately lock the set of candidate cell instances that match the cell instances recorded by the current calculation task at the grouping level.

[0095] Aggregate calculations are performed based on the list of candidate cell instances, and the conditional expression is evaluated to obtain the value of the conditional expression.

[0096] Furthermore, after determining the list of candidate cell instances for the aggregation scope, the report engine extracts the actual data values ​​of all cell instances in the candidate cell instance list as input parameters for the aggregation function, performs the corresponding aggregation operation, and obtains the aggregation result value. Subsequently, the report engine substitutes this aggregation result value back into the conditional expression encapsulated by the calculation task item, replaces the corresponding aggregation function node, and combines it with the data values ​​of the cell instances recorded by the current calculation task item to perform a Boolean evaluation on the complete conditional expression, obtaining the final calculation result of the conditional expression.

[0097] Through the above processing, the present invention automatically derives the aggregation scope by utilizing extended topological relationships, avoiding the aggregation calculation deviations caused by incomplete extension or incorrect range specification in existing solutions, and ensuring the accuracy and automation of conditional expression evaluation.

[0098] S4, based on the value of the calculated conditional expression, applies the corresponding custom style to the cell instance recorded by the current calculation task item.

[0099] Furthermore, based on the value of the conditional expression, the report engine matches the corresponding style branch in the conditional attribute of the calculation task item and extracts the custom style information defined under that branch. The conditional attribute defines the style settings corresponding to when the condition is true and false, and in some cases, multiple conditional branches are supported. Custom style information includes at least foreground color, background color, font name, font size, font weight, font italics, underline, border style, border color, text alignment, and cell instance visibility. After extraction, the report engine temporarily stores the extracted custom style information in the style attribute of the cell instance.

[0100] After completing the evaluation of all conditional expressions and the application of styles, this method also includes:

[0101] The original styles and custom styles of each cell instance are merged to generate a style mapping table for front-end rendering. The style mapping table includes a mapping table of cell coordinates and style identifiers, and a mapping table of style identifiers and style definitions.

[0102] Furthermore, during the report design phase, each cell template has a predefined default style. During dynamic expansion and the application of conditional attributes, some cell instances are appended with custom styles generated in S4. Since custom styles may only cover some style attributes—for example, defining only background and font colors while neglecting borders and font size—it is necessary to merge the predefined styles with the custom styles to form the final style for each cell instance.

[0103] The merging process follows a preset priority rule that ensures custom styles triggered by conditional attributes override the default original styles. Specifically, for the same style attribute, if the value of the attribute is explicitly defined in the custom style, the custom style takes precedence; if the attribute is not defined in the custom style, the definition of the attribute in the original style is retained. The final merged style contains the complete definition of all style attributes required for rendering the cell instance.

[0104] After merging the styles of all cell instances, the report engine generates the following two mapping tables for use by the front-end rendering engine.

[0105] The mapping table establishes the correspondence between cell coordinates and style identifiers. Each cell instance's unique coordinates (consisting of the report page number, row number, and column number) serve as the key, with the style identifier as the value. The style identifier is a unique identifier that distinguishes different style combinations. When merging styles, the report engine performs a hash calculation or sequential numbering on the final styles to generate corresponding style identifiers. If multiple cell instances have identical final styles, they share the same style identifier, effectively reducing redundant data. Through this mapping table, the front-end rendering engine can quickly look up the corresponding style identifier for any cell instance based on its coordinates.

[0106] This is a mapping table that establishes the correspondence between style identifiers and style definitions, with style identifiers as keys and their corresponding complete style definitions as values. A style definition contains the specific values ​​of all rendering properties under that style, such as font being SimSun, font size being 12px, foreground color being #FF0000, background color being #FFFFFF, and border being 1px solid #000000. Through this mapping table, the front-end rendering engine, after obtaining the style identifier of a cell instance, further retrieves the complete style definition, thereby completing the final rendering of that cell instance.

[0107] By storing the two mapping tables separately, the front-end only needs to load these two mapping tables to complete the efficient rendering of the entire report. There is no need to transmit the complete style attribute strings of each cell instance, which reduces the amount of data transmission and front-end parsing overhead.

[0108] like Figure 6 As shown, another embodiment of the present invention provides a report condition attribute calculation system with automatic aggregation range identification, including a delayed calculation queue management module, an aggregation function identification module, an aggregation range derivation module, and a style application module. The modules work collaboratively through data transfer and process scheduling to jointly complete the entire processing flow from dynamic expansion monitoring to final style application.

[0109] The delayed calculation queue management module is used to encapsulate cell instances with conditional attributes as calculation task items and add them to the delayed calculation queue during the dynamic expansion and data filling process of report cells. It also synchronously builds and maintains the row direction sub-cell mapping table, the column direction sub-cell mapping table, and the global cell name mapping table.

[0110] The aggregate function identification module is used to sequentially traverse each calculation task in the delayed calculation queue after the dynamic expansion and data filling of all cells in the table are completed, and identify the aggregate functions nested in the conditional expressions of the cell instances recorded by the calculation task.

[0111] The aggregation range derivation module is used to deduce the aggregation scope of aggregate functions based on the extended topological relationships of the cell instances recorded in the current calculation task, and to calculate the value of the conditional expression.

[0112] The Style Application module is used to apply the corresponding custom style to the cell instances recorded by the current calculation task item based on the value of the calculated conditional expression.

[0113] The specific working process and implementation principle of each module in this system embodiment correspond one-to-one with the aforementioned method embodiment, and will not be repeated here.

[0114] In summary, this invention proposes a method and system for automatically identifying aggregation ranges and calculating report conditional attributes. This invention overcomes the limitations of existing report engines that rely on manual syntax definition of aggregation intervals, achieving automatic derivation of the aggregation scope from two dimensions: temporal control and spatial topology. Regarding temporal control, it abandons the traditional real-time calculation mode and adopts a delayed calculation strategy. It encapsulates the unique identifier, conditional expression, and current extension context information of the currently dynamically expanded cell instance with configured conditional attributes into a single calculation task, uniformly aggregating them into a pre-created delayed calculation queue. This avoids the problem of incomplete aggregation data sets caused by the incomplete generation of sub-cell instances under the same group during dynamic expansion. Simultaneously, it constructs and maintains row-direction sub-cell mapping tables, column-direction sub-cell mapping tables, and a global cell name mapping table, providing a retrieval basis for rapid location of the aggregation scope later. Furthermore, in terms of semantic parsing, a syntax parser is used to perform lexical analysis on the conditional expression. Through parsing and semantic analysis, an abstract syntax tree is constructed to accurately extract nested structures and identify the hierarchical relationships of each syntactic unit. By recursively traversing and marking aggregate function nodes, and extracting the cell names referenced in their parameter information, the limitations of regular expression matching in handling multi-level nesting are overcome, providing a clear basis for scope deduction. In terms of spatial topology, based on the extended topological relationships of cell instances recorded in the current calculation task, the algorithm traces upwards along its left parent cell relationship chain and / or upper parent cell relationship chain. It then retrieves cell instances within the corresponding hierarchical grouping container using a pre-built mapping table. Finally, a list of candidate cell instances is determined through a preset merging strategy based on row and column search results, either discarding or finding intersections, thus achieving automatic and precise locking of the aggregation scope. Through the synergistic cooperation of delayed computation, semantic parsing, and topological tracing, business users can automatically adapt to different user-designed grouping directions without manually specifying aggregation range expressions. In complex dynamic expansion scenarios such as two-dimensional cross grouping, it accurately locks the matching set of candidate cell instances, ensuring the accuracy and automation of conditional expression evaluation, and improving the intelligence and usability of the reporting engine.

[0115] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various variations or substitutions within the technical scope disclosed in this application, and these should all be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for calculating report condition attributes with automatic aggregation range recognition, characterized in that, include: During the dynamic expansion and data filling of report cells, cell instances containing conditional attributes are encapsulated as calculation task items, added to the delayed calculation queue, and row-direction sub-cell mapping tables, column-direction sub-cell mapping tables, and global cell name mapping tables are built and maintained simultaneously. After the entire table of cells is dynamically expanded and populated, each calculation task in the delayed calculation queue is traversed sequentially to identify the aggregate function nested in the conditional expression of the cell instance recorded by the calculation task. Based on the extended topological relationship of the cell instances recorded in the current calculation task, the aggregation scope of the aggregate function is derived, and the value of the conditional expression is calculated. Based on the value of the calculated conditional expression, apply the corresponding custom style to the cell instance recorded for the current calculation task item.

2. The method for calculating report condition attributes with automatic aggregation range identification according to claim 1, characterized in that, The aggregate function nested in the conditional expression that identifies the cell instance recorded by the calculation task item includes: The conditional expressions of the cell instances recorded in the current calculation task are parsed using a syntax parser, and an abstract syntax tree is constructed. Recursively traverse the nodes of the abstract syntax tree to identify aggregate function nodes; Extract the parameter information of the aggregate function node to obtain the cell name referenced therein; the parameter information contains the reference expression for the cell name.

3. The method for calculating report condition attributes with automatic aggregation range identification according to claim 1, characterized in that, The derivation of the aggregation scope of the aggregation function and the calculation of the value of the conditional expression include: Determine the type of the cell expression in the aggregate function, and based on the determination result, obtain the corresponding candidate cell instance list; Aggregate calculations are performed based on the list of candidate cell instances, and the conditional expression is evaluated to obtain the value of the conditional expression.

4. The method for calculating report condition attributes with automatic aggregation range identification according to claim 3, characterized in that, The step of obtaining the corresponding candidate cell instance list based on the judgment result includes: If the expression is determined to be a full cell expression, then the corresponding cell instance list is retrieved from the global cell name mapping table using the cell name as the key, and used as the candidate cell instance list. If the expression is determined to be a regular cell expression, the search is performed along the left parent cell relationship chain and / or the upper parent cell relationship chain of the cell instance recorded in the current calculation task. Based on the search results, a preset merging strategy is used to determine the final list of candidate cell instances.

5. The method for calculating report condition attributes with automatic aggregation range identification according to claim 4, characterized in that, Search along the left parent cell relationship chain of the cell instance recorded in the current calculation task, including: Retrieve the left parent cell object of the cell instance recorded in the current calculation task item; Check if the left parent cell object is empty. If it is empty, terminate the search and return an empty list. If it is not empty, check if the name of the left parent cell object matches the name of the target cell. If they match, return a list containing the left parent cell object. If they do not match, query the pre-built row-direction child cell mapping table of the left parent cell object, and retrieve the corresponding cell instance list using the name of the target cell as the key. If found, return the cell instance list as a candidate in the row direction. If not found, treat the left parent cell object as the new current traversed cell instance, recursively execute the above search steps, and continue tracing upwards along the left parent cell relationship chain until a match is found or the top of the left parent cell relationship chain is reached, and return an empty list.

6. The method for calculating report condition attributes with automatic aggregation range identification according to claim 4, characterized in that, Search along the parent cell relationship chain of the cell instance recorded in the current calculation task, including: Retrieve the parent cell object of the cell instance recorded in the current calculation task item; Check if the parent cell object is empty. If it is empty, terminate the search and return an empty list. If it is not empty, check if the name of the parent cell object matches the name of the target cell. If they match, return a list containing the parent cell object. If they do not match, query the pre-built column-direction child cell mapping table of the parent cell object, and retrieve the corresponding cell instance list using the name of the target cell as the key. If found, return the cell instance list as a candidate in the column direction. If not found, treat the parent cell object as the new current traversed cell instance, recursively execute the above search steps, and continue tracing upwards along the parent cell relationship chain until a match is found or the top of the parent cell relationship chain is reached, and return an empty list.

7. The method for calculating report condition attributes with automatic aggregation range identification according to claim 4, characterized in that, The step of determining the final list of candidate cell instances based on the search results using a preset merging strategy includes: Retrieve the list of target cells to the left along the left parent cell relationship chain and the list of target cells above along the top parent cell relationship chain; Based on the existence of the target cell list on the left and the target cell list above, a preset merging strategy is used to determine the final list of candidate cell instances.

8. The method for calculating report condition attributes with automatic aggregation range identification according to claim 7, characterized in that, The preset merging strategy includes: If the left target cell instance list is not empty and the top target cell instance list is empty, return the left target cell instance list as the final candidate cell instance list; If the list of target cell instances above is not empty and the list of target cell instances on the left is empty, return the list of target cell instances above as the final list of candidate cell instances; When neither the left-hand target cell instance list nor the top-hand target cell instance list is empty, calculate the intersection of the two lists and return the intersection list as the final candidate cell instance list; When both the target cell instance list on the left and the target cell instance list above are empty, retrieve and return the complete list of all cell instances corresponding to the target cell name from the global cell name mapping table.

9. The method for calculating report condition attributes with automatic aggregation range identification according to claim 1, characterized in that, Also includes: After all conditional expressions have been calculated and styles have been applied, the original styles of the cell instances and the custom styles are merged to generate a style mapping table for front-end rendering. The style mapping table includes a mapping table of cell coordinates and style identifiers, and a mapping table of style identifiers and style definitions.

10. A report condition attribute calculation system with automatic aggregation range identification, characterized in that, include: The delayed calculation queue management module is used to encapsulate cell instances with conditional attributes as calculation task items and add them to the delayed calculation queue during the dynamic expansion and data filling of report cells. It also synchronously builds and maintains the row direction sub-cell mapping table, the column direction sub-cell mapping table, and the global cell name mapping table. The aggregate function identification module is used to sequentially traverse each calculation task in the delayed calculation queue after the dynamic expansion and data filling of all cells in the table are completed, and identify the aggregate functions nested in the conditional expressions of the cell instances recorded by the calculation task item. The aggregation range derivation module is used to deduce the aggregation scope of aggregate functions based on the extended topological relationship of the cell instances recorded in the current calculation task item, and to calculate the value of the conditional expression. The Style Application module is used to apply the corresponding custom style to the cell instances recorded by the current calculation task item based on the value of the calculated conditional expression.