Foldable multi-dimensional grouped data table generation method and system
By constructing a folded table model and a multi-level hash table structure, the dimensions of the data table are dynamically adjusted, solving the problems of fixed dimensions and limited display in traditional data analysis, and realizing flexible display and efficient querying of multi-dimensional data.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DAREWAY SOFTWARE
- Filing Date
- 2026-01-16
- Publication Date
- 2026-04-28
AI Technical Summary
Traditional data analysis methods cannot freely adjust statistical analysis dimensions, have limited display scope, require rebuilding query pages, are time-consuming, and cannot meet diverse query needs.
Construct a collapsible table model to generate a multi-level hash table structure that supports dimension adjustment and data grouping display. Expand and collapse the table through operation identifiers and dynamically generate query tables.
It enables free combination queries for multi-dimensional data analysis, improves the flexibility and efficiency of data display, and reduces memory usage and code processing complexity.
Smart Images

Figure CN121935249A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data analysis and processing technology, and in particular relates to a method and system for generating foldable multi-dimensional grouped data tables. Background Technology
[0002] The statements in this section are merely background information related to the present invention and do not necessarily constitute prior art.
[0003] With the development of information technology, data is becoming increasingly abundant, and data analysis is gradually expanding from single-dimensional to multi-dimensional data analysis. In the traditional model, information systems use multiple query function menus to display statistical data of fixed dimensions or to display all data through a fixed menu for analysis. This model has the following main problems: First, the displayed statistical content is fixed and cannot fully cover different query dimensions, limiting the scope of display; second, data analysts cannot freely adjust the dimensions of statistical analysis, failing to meet diverse query needs; and third, multiple different functional pages need to be developed, and if the query dimensions change, the query page needs to be rebuilt and developed, which is time-consuming. Summary of the Invention
[0004] To address at least one of the technical problems mentioned above, this invention provides a method and system for generating foldable multi-dimensional grouped data tables. This system can group and display data according to different dimensions, and can use a single grouped report to comprehensively analyze data from multiple dimensions while supporting dimension adjustments.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: The first aspect of the present invention provides a method for generating a collapsible multi-dimensional grouped data table, comprising the following steps: S1. Analyze and process the fact detail tables of different business domains, classify the data fields of the fact detail tables to obtain dimension fields and measure fields, determine the target dimension fields and measure fields according to business requirements, build a folded table model, and generate folded detail data. S2. Based on the query requirements, obtain the dimensions from the folded table model and construct the dimension order sequence. Based on the dimension order sequence, convert the folded detail data into a multi-level hash table structure for storage. S3. Set an operation identifier for each dimension, construct a combined table structure based on the folded table model and the hash table structure, and render the initial grouped data table using the combined table structure; in response to the expansion or collapse operation of the dimensions of the grouped data table, update the combined table structure and re-render the table content. S4. In response to the change operation on the dimension display order of the grouped data table, generate a new dimension order sequence, and re-execute S2 to S3 based on the new dimension order sequence to update the grouped data table.
[0006] Furthermore, the construction of the folded table model and the generation of folded detail data includes: Based on the determined target dimension fields and metric fields, a dimension information table and a metric information table are generated. The corresponding target dimension fields and target metric fields are retrieved from these tables. The retrieved dimensions are those required for data analysis in the current analysis scenario, and the retrieved metrics are those that can be directly obtained from the fact detail table or calculated for the current dimension. A mapping relationship is established between the target dimension fields and target metric fields and the original fact detail table. Then, the data transformation logic is determined based on the dimension processing method and metric processing method in the dimension information table and metric information table. The data transformation logic in the folded table model is executed to generate folded detail data from the fact detail table. The folded detail data contains detailed data content related to the dimension fields and metric fields of the corresponding folded table model.
[0007] Furthermore, the construction of the multi-level hash table structure includes: the key is the dimension value, the value is the hash table, the hash table stores the hash table structure of the next level dimension and the data information of the current dimension, and the hash table is used to map the hierarchical relationship between dimensions. The bottom-level hash table structure is the value of the last dimension in the dimension sequence and the corresponding metric information.
[0008] Furthermore, storing the folded detail data by converting it into a multi-level hash table structure includes: The outermost hash table structure contains two types of key values: first dimension value information and data. The first dimension value information is the specific value of the first dimension field in the dimension sequence in the folded detail data table. Each value corresponds to a record. The corresponding value is the second hash table structure containing the data of the corresponding dimension value. The record with the key value of data stores the folded detail data. All folded detail data objects are stored in the form of an array. The innermost hash table structure contains two types of keys: the last dimension value information and data. The last dimension value information is the value of the last dimension in the collapsed detail data table after all preceding dimensions have been fixed. Each value corresponds to one record, and the value of this record is the data detail object corresponding to all dimensions after all dimensions have been fixed. For records with the key value "data", the value is stored in the form of an array, which stores the data detail objects that satisfy the preceding dimension values. The key values of the intermediate layer hash table structure include two categories: the value information of the first M levels of dimensions and data; among them, the value information of the first M levels of dimensions is the value information of the Mth level of dimensions in the stacked detailed data corresponding to the first M-1 levels of dimensions taking corresponding values in the dimension order sequence, the corresponding value value is the hash table structure of the M+1th layer, the Key value is the record of data, and the value stores the data detail object corresponding to the first M-1 levels of dimensions taking corresponding values, 1 < M < N, and N is the number of dimensions in the dimension order sequence.
[0009] Furthermore, constructing a combined table structure based on the folded table model and the hash table structure includes: Taking the dimensions and metrics in the folded table model as the headers of the combined table, and sorting the dimensions according to the dimension order sequence; Initializing the data content of the combined table structure: expanding the data content of the first dimension, and the number of data entries is the number of values of the first dimension; the data values of the first dimension are the values of the first dimension, the data of other dimensions are status flags, and the values of the metric fields in each row of data are obtained by summing the corresponding fields by traversing the array object corresponding to data in the hash table structure of the next dimension. If the metric field is a derived metric field, it is calculated from the corresponding original field according to the metric field calculation rule.
[0010] Furthermore, in response to the dimension expansion operation on the grouped data table, updating the combined table structure and re-rendering the table content includes: Selecting the target row in the grouped data table and changing the status of the target dimension to expanded; According to the hash table structure, adding multiple data corresponding to the target dimension to the combined table structure; The newly added data is the number of data entries with the key as the dimension value in the hash table structure corresponding to the target dimension. The value of each specific metric field is obtained by summing the corresponding columns by traversing the data objects corresponding to the data column in the next-level hash table structure; if there is no next-level hash table structure, the corresponding field data in the stored object in the value column is added to the combined table structure; deleting the original selected and expanded row data from the combined table structure, and adding a folding status flag to the value corresponding to the upper-level dimension of the expanded dimension; Re-rendering the table according to the changed combined table structure, and merging the tables with the same dimension values to form a new grouped data table.
[0011] Furthermore, in response to the dimension folding operation on the grouped data table, updating the combined table structure and re-rendering the table content includes: Selecting the folding flag of the target dimension of the grouped data and changing the dimension status flag to folded; Add a new data entry to the combined table structure, set the field value of the current dimension of the collapsed data to the collapse flag, and keep the values of other dimension fields consistent with those before the data merge. The value of the measure field of the new data is summarized by the corresponding field of the grouped data involved in the collapse operation. For measure fields that can be summed, sum them up. For measure fields that are calculated using other fields, use the processed fields to generate field data according to the same logic. Store the generated new field data in the combined table structure and delete the original grouped data involved in the collapse operation from the combined table structure. The table is re-rendered based on the adjusted combined table structure, and dimension fields with the same content are merged into a single table.
[0012] A second aspect of the present invention provides a collapsible multi-dimensional grouped data table generation system, comprising: The configuration management module is used to analyze and process the fact detail tables of different business domains, classify the data fields of the fact detail tables to obtain dimension fields and measure fields, determine the target dimension fields and measure fields according to business requirements, build a folded table model, and generate folded detail data. The hash table structure management module is used to obtain dimensions from the folded table model according to query requirements, construct a dimension order sequence, and convert the folded detail data into a multi-level hash table structure for storage based on the dimension order sequence. The table assembly and rendering module is used to set operation identifiers for each dimension, construct a combined table structure based on the collapsed table model and the hash table structure, and render the initial grouped data table using the combined table structure; in response to the expansion or collapse operation of the dimensions of the grouped data table, the combined table structure is updated and the table content is re-rendered. The grouping table structure change module is used to generate a new dimension order sequence in response to a change in the dimension display order of the grouping data table, and to trigger the hash table structure management module and the table assembly and rendering module to reconstruct and render the grouping data table based on the new dimension order sequence.
[0013] A third aspect of the present invention provides a computer-readable storage medium.
[0014] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for generating a collapsible multidimensional grouped data table as described above.
[0015] A fourth aspect of the present invention provides a computer device.
[0016] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method for generating a collapsible multi-dimensional grouped data table as described above.
[0017] Compared with the prior art, the beneficial effects of the present invention are: This invention constructs a folded table model by sorting through raw data, determining dimensions and metrics, and then generating a multi-layered hash table structure to store the logical relationships of the data. This creates a combined table structure for rendering, supporting the expansion, collapse, and conversion of table dimension order. It meets the needs of multi-dimensional data analysis, grouping and displaying data according to different dimension expansions. Users can use a single grouped report to comprehensively analyze data from multiple dimensions, with support for dimension adjustment and flexible dimension combination queries. The system dynamically generates query tables based on dimension selection, presenting data more intuitively and conveniently. In terms of data processing, this invention selects suitable dimensions and metrics to construct a foldable table model, generates detailed data, and uses a hash table to nest the detailed data by dimension for storage. First, the structure is simple and clear, and data access is more convenient. Second, it is based on detailed data object storage, which only saves reference addresses, reducing memory usage. Third, by preprocessing the data, it not only improves the response performance of the foldable multi-dimensional grouped data table, but also simplifies the code processing logic.
[0018] In the process of constructing a collapsible multidimensional grouped data table, this invention allows users to select the dimensions to be displayed in the collapsible table according to their needs and to display grouped data according to the order of the dimensions. The order of the dimensions can be adjusted at will to meet the data query requirements under any combination. It supports the expansion / collapse operation of the grouped table, which is more conducive to data analysts viewing the data status from different dimensional perspectives.
[0019] This invention constructs a combined table structure based on a folded table model during table rendering. The content of the combined table structure is adjusted during the dimensional expansion and folding of the folded grouped tables, which can effectively reduce the complexity of data query processing and improve query efficiency.
[0020] Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0021] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.
[0022] Figure 1 This is a flowchart of a method for generating a foldable multi-dimensional grouped data table according to an embodiment of the present invention; Figure 2 This is a block diagram of a foldable multi-dimensional grouped data table generation system provided in an embodiment of the present invention. Detailed Implementation
[0023] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0024] It should be noted that the following detailed description is illustrative and intended to provide further explanation of the invention. Unless otherwise specified, 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 invention pertains.
[0025] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0026] Example 1 This embodiment provides a method for generating a collapsible, multi-dimensional grouped data table, including the following steps: Step 1: Analyze and process the fact detail tables obtained from different business domains, classify the fields of the fact detail tables to obtain dimension fields and measure fields, determine the target dimension fields and measure fields according to business requirements, construct the folded table data model, and generate folded detail data; Specifically, the steps include the following: Step 101: Obtain the fact detail tables for different business domains, classify the fields in the fact detail tables for different business domains, and obtain the dimension fields and measure fields; In this embodiment, the fields in the fact detail table data used for classification and data analysis from different dimensions are divided into dimension fields. Specifically, dimension fields can be native fields from the fact details table or derived fields that have been processed in various ways; Furthermore, derived fields are new fields that can be obtained from the original field data after processing, such as obtaining a quarter field based on a specific time, obtaining a range field based on a quantity field, or forming a field based on the content of multiple fields.
[0027] The fields used for aggregation operations in the fact details table are divided into measure fields; Specifically, the measure field can be the original measure field in the fact detail table, or it can be a derived measure field that can be calculated from the original measure field.
[0028] Furthermore, derived fields are new fields that can be calculated, such as year-on-year fields, month-on-month fields, year-on-year increments, and month-on-month increments generated from quantity fields.
[0029] Take Table 1, the example of the instance fact details table: Table 1 Example Fact Details Table
[0030] Selectable dimension information includes year (derived dimension), quarter, region, product, product category, and sales personnel; selectable metric information includes quantity, sales amount, year-on-year growth in sales amount (derived metric), and month-on-month growth in sales amount (derived metric). Step 102: Construct a dimension information table based on the defined dimensions, establish the relationship between the fact detail table and the dimensions, and the dimension table; construct a measurement information table based on the defined measures, and establish the relationship between the measures and the fact detail table. Specifically, establishing the relationship between fact detail tables and dimensions, and dimension tables, means that a fact table can be associated with multiple dimensions, a dimension can be associated with a dimension table, and each dimension can be associated with multiple fact tables.
[0031] In this embodiment, the dimension information table includes at least some or all of the following information items: dimension code, dimension attribute, dimension column, dimension column type, dimension value, and dimension processing method. Among them, the dimension code is the unique identifier of the dimension; Dimension attributes indicate the type of the dimension, including native fields and derived fields; The dimension column is the column field name in the fact details table corresponding to that dimension. If it is a derived dimension field, it corresponds to one or more column fields. The dimension column type is the data type of the column field in the fact details table corresponding to that dimension; The dimension value is the result of the dimension's values. The dimension value result should contain the union of all values of the specific fields in the fact detail table associated with the dimension. Dimension processing method: For derived dimension fields, record the method by which the original field generates the derived field.
[0032] In this embodiment, the measurement information table includes at least some or all of the following information items: measurement code, measurement attribute, measurement column, measurement column type, and measurement processing method.
[0033] A metric code is a unique identifier for a metric. Metric attributes identify the type of metric, including native metric fields and derived metric fields; The measure column is the name of the column field in the fact details table corresponding to the measure. If it is a derived measure field, it corresponds to one or more original measure fields. The measure column type can be either the data type of the corresponding original measure field or a custom data type. The measurement processing method records the method for generating derived fields from native measurement fields, specifically for derived measurement fields.
[0034] Step 103: Based on business requirements, select the target dimension field and target metric field from the dimension information table and the metric information table to construct the folded table model and form folded detailed data; In this embodiment, the construction of the folded table model includes: Retrieve the corresponding target dimension field and target metric field information from the dimension information table and the metric information table. The retrieved dimensions are the dimensions required for data analysis in the current analysis scenario, and the retrieved metrics are the metric fields that can be obtained directly from the raw data or through calculation under the current dimension. Establish a mapping relationship between the target dimension field and the target measure field and the original fact detail table. Then, determine the data transformation logic based on the dimension processing method and measure processing method in the dimension information table and measure information table. The data transformation logic is the method of converting the fact detail table data into folded detail data, which includes but is not limited to SQL statements, stored procedures, and ETL extraction processes. Running the data transformation logic can generate folded detail data.
[0035] Continuing with Table 1 as an example, we will build a sample folded table model, select quarter, region, and product as dimensions, select quantity and sales amount as measures, write executable data transformation logic, and obtain the corresponding folded detail data from the sample implementation detail table.
[0036] Step 104: Execute the data transformation logic in the folded table model to generate folded detail data from the fact detail table data. The folded detail data contains the detail data content related to the dimension fields and measure fields of the corresponding folded table model.
[0037] Step 2: Based on the query requirements, obtain the dimensions from the folded table model and construct the dimension order sequence. Then, based on the dimension order sequence, convert the folded detail data into a multi-level hash table structure for storage. Specifically, the steps include the following: Step 201: Obtain the usable dimension information from the folded table model, sort the dimensions according to requirements, and form a dimension order sequence; Taking the example folded table model as an example, the dimension order sequence can be selected as 1. Quarter, 2. Region, 3. Product; Step 202: Generate a corresponding data detail object for each record of the folded detail data. The data detail object contains all the field names and corresponding values of the record; Table 2 shows the mapping of folded detail data and objects. Table 2 shows an example of folded detail data and object mapping.
[0038] Step 203: Construct a multi-layer hash table structure according to the order relationship of the dimension order sequence, and store the data detail objects; Among them, the key is the dimension value, and the value is a hash table. The hash table stores the next-level dimension hash table structure and the data information of the current dimension. The hierarchical relationship between dimensions is mapped through the hash table. The hash table structure at the bottom layer is the value of the last dimension in the dimension order sequence and the corresponding metric information.
[0039] Specifically: The key values of the outermost hash table structure include two categories: the first dimension value information and data. Among them, the first dimension value information is the specific value of the first dimension field in the dimension order sequence in the folded detail data table. Each value corresponds to a record information, and its corresponding value is the second hash table structure containing the data corresponding to the dimension value. The record with the key value of data stores the folded detail data and stores all the folded detail data objects in the form of an array; The key values of the innermost hash table structure include two categories: the last dimension value information and data. Among them, the last dimension value information is the value data of the last dimension in the folded detail data table after all the previous dimensions take fixed values. Each value corresponds to a record, and the value of this record is the data detail object corresponding to all the dimensions taking fixed values. For the record with the key value of data, the value is stored in the form of an array as the data detail objects that meet the previous dimension value.
[0040] The key values of the middle-layer hash table structure include two categories: the Mth (1 < M < N, N is the number of dimensions in the dimension order sequence) layer dimension value information and data. Among them, the Mth layer dimension value information is the value information of the Mth layer dimension in the folded detail data corresponding to the previous M - 1 dimensions taking corresponding values in the dimension order sequence, and the corresponding value is the (M + 1)th layer hash table structure. For the record with the key value of data, the value stores the data detail objects corresponding to the previous M - 1 dimensions taking corresponding values.
[0041] Taking the three-layer dimension hash table structure as an example, the specific structure of the three-layer dimension hash table structure is shown in Table 3: Table 3 Three-layer dimension hash table structure
[0042] According to the selected order, the example folded report detail data can be constructed into the data structure shown in Table 4: Table 4 Three-layer dimension hash table structure of the folded report detail data
[0043] Step 3: Set an operation identifier for each dimension, build and initialize a combined table structure based on the collapsed table model and hash table structure, and render the initial grouped data table using the combined table structure; in response to the expansion or collapse operation of the dimensions of the grouped data table, update the combined table structure and re-render the table content to realize the change of the displayed content of the grouped data table. Specifically, the steps include the following: Step 301: Set the operation identifier state for each dimension; In this embodiment, the operation identifier state is divided into two types: expanded state and collapsed state. By default, the operation identifier state of all dimensions is collapsed state. The lower dimension can only be expanded if the upper dimension state is expanded.
[0044] Step 302: Construct and initialize a combined table structure based on the folded table model and hash table structure; Specifically, the steps include the following: Construct a combined table structure based on the folded table model, using the dimensions and measures in the folded table model as the table header of the combined table, sorting the dimensions according to the dimension order sequence, and adding an adjustment order flag for each dimension field; Initially, the combined table structure expands the data content of the first dimension, with the number of data rows equal to the number of values in the first dimension. The data values of the first dimension are the values of the first dimension itself, while the data of other dimensions are status indicators, defaulting to a collapsed state. The value of the measure field for each row is obtained by iterating through the array object corresponding to data in the hash table structure of the next dimension and summing the corresponding fields. If the measure field is a derived measure field, it needs to be calculated from the corresponding original field according to the measure field calculation rules. Step 303: Render the initial grouped data table using a combined table structure; Based on the table header and initial data in the combined table structure, an initial grouped data table is formed using various table development technologies. The table header field adds an adjustment order flag to each dimension. Data row fields with specific numerical values are displayed in the grouped data table, and dimension status flags are displayed for dimension status indicators. Step 304: In response to the expansion or collapse operation of the dimensions of the grouped data table, update the combined table structure and re-render the table; Specifically, it includes: Step 3041: In response to the dimension expansion operation on the grouped data table, update the combined table structure and re-render the table, specifically including: Select a row of data in the grouped data table and change the state of the dimension. If the dimension state changes from collapsed to expanded, add multiple data rows corresponding to that dimension to the combined table structure according to the hash table structure. The added data is the number of data rows in the hash table structure corresponding to this dimension, where the key is the dimension value. The specific metric field value is obtained by traversing the data objects in the data column of the next-level hash table structure and summing the corresponding columns. If there is no next-level hash table structure, the corresponding field data of the object stored in the value column is added to the combined table structure. Remove the original selected extended row data from the combined table structure, and add a folded status flag to the value corresponding to the parent dimension of the extended dimension; Based on the changed combined table structure, the table is re-rendered, and tables with the same dimension values are merged to form a new grouped data table. Step 3042: In response to the dimension collapse operation on the grouped data table, update the combined table structure and re-render the table content, including: If you need to merge a group of grouped data, change the expanded state of the upper dimension of the data to be merged to the collapsed state. If you want to merge and collapse a group of data in the grouped data table, select the collapsed indicator of the upper dimension of the grouped data, change the dimension status indicator to collapsed, add summary data in the combined table structure, and delete the grouped data involved. Add a new record to the combined table structure, setting the field value of the collapsed current dimension to the collapse flag, while keeping the values of other dimension fields consistent with those before data merging. The measure field values are summed from the corresponding fields of the grouped data involved in the collapse operation. For measure fields that can be summed, sum them; for measure fields calculated using other fields, generate new field data using the same logic after processing, and store the generated new field data in the combined table structure.
[0045] Remove the original grouped data involved in the folding operation from the combined table structure.
[0046] The table is re-rendered based on the adjusted combined table structure, and dimension fields with the same content are merged into a single table.
[0047] Step 4: In response to the change operation on the dimension display order of the grouped data table, generate a new dimension order sequence, and re-execute steps 2 to 3 based on the new dimension order sequence to update the grouped data table.
[0048] Example 2 like Figure 2 As shown, this embodiment provides a collapsible multi-dimensional grouped data table generation system, including: The configuration management module 21 is used to analyze and process the fact detail tables of different business domains, classify the data fields of the fact detail tables to obtain dimension fields and measure fields, determine the target dimension fields and measure fields according to business requirements, build a folded table model, and generate folded detail data. The hash table structure management module 22 is used to obtain dimensions from the folded table model according to the query requirements, construct a dimension order sequence, and convert the folded detail data into a multi-level hash table structure for storage according to the dimension order sequence. The table assembly and rendering module 23 is used to set operation identifiers for each dimension, construct a combined table structure based on the folded table model and the hash table structure, and render the initial grouped data table using the combined table structure; in response to the expansion or collapse operation of the dimensions of the grouped data table, the combined table structure is updated and the table content is re-rendered. The grouping table structure change module 24 is used to generate a new dimension order sequence in response to a change operation on the dimension display order of the grouping data table, and trigger the hash table structure management module and the table assembly rendering module to reconstruct and render the grouping data table based on the new dimension order sequence.
[0049] Configuration management module 21 includes dimension management 211, metric management 212, folded table model construction 213, and folded detail data generation 214; The dimension management module 211 is used to generate available dimension field information, including native dimensions and derived dimensions, and to establish the relationship between dimensions and the fact table; The metrics management module 212 is used to generate usable metrics information, including native metrics and derived metrics, and to establish the relationship between metrics and the fact table; The folded model building module 213 selects different dimensions and metric fields to build a folded table model based on business needs.
[0050] The folded detail data generation module 214 executes the data transformation logic of the folded table data model to generate folded detail data from the factual detail data. The folded detail data contains the detail data content related to the dimension fields and measure fields corresponding to the folded table model.
[0051] The hash table structure management module 22 is used to construct the hash table structure according to the dimension order, and includes the dimension order management module 221 and the hash table structure construction module 222.
[0052] The dimension order management module 221 is used to obtain usable dimension information from the folded table model, sort the dimensions according to requirements, and form a dimension order sequence.
[0053] The hash table structure construction module 222 is used to construct a multi-level hash table structure for storage based on the dimension order sequence. The key is the dimension value, and the value is the hash table. The hash table stores the hash table structure of the next level dimension and the data information of the current dimension. The hash table is used to map the hierarchical relationship between dimensions.
[0054] The table assembly and rendering module 23 is used to form a collapsible grouped table based on the hash table structure and to realize the expansion and collapse of dimensions. It includes a combined table structure generation module 231, a table rendering module 232, a dimension expansion module 233, and a dimension collapse module 234. The combined table structure generation module 231 constructs a combined table structure based on the folded table model, uses the dimensions and measures in the folded table model as the header of the combined table, and obtains data from the hash table structure and dimension operation identifiers to form the data of the corresponding columns of the combined table structure.
[0055] The table rendering module 232 is used to render the table according to the combined table structure. It forms an initial grouped data table through various table development technologies. Data row field values with specific numerical values are displayed in the grouped data table, and dimension status identifiers are displayed for dimension status identifiers. Dimension expansion module 233: When the dimension state changes from collapsed to expanded, add multiple data records corresponding to that dimension to the combined table structure, delete the original extended fields, and re-render the table.
[0056] The dimension folding module 234, when merging grouped data in a grouped data table, adds summary data, deletes expanded data, and re-renders the table in the combined table structure.
[0057] The grouping table dimension change module 24 changes the display order of dimensions in the grouping data table. It generates a new dimension order sequence by dragging dimensions, and generates a new hash table structure based on the new dimension order sequence, thus reconstructing the grouping table.
[0058] It should be noted that the specific implementation of the collapsible multi-dimensional grouped data table generation system of this invention is similar to the specific implementation of the collapsible multi-dimensional grouped data table generation method of this invention. Please refer to the description in the method section for details. In order to reduce redundancy, it will not be repeated here.
[0059] Example 3 This embodiment provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps in the method for generating a collapsible multi-dimensional grouped data table as described above.
[0060] Example 4 This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps in the method for generating a collapsible multi-dimensional grouped data table as described above.
[0061] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.
[0062] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0063] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0064] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0065] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0066] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for generating a collapsible, multi-dimensional grouped data table, characterized in that, Includes the following steps: S1. Analyze and process the fact detail tables of different business domains, classify the data fields of the fact detail tables to obtain dimension fields and measure fields, determine the target dimension fields and measure fields according to business requirements, build a folded table model, and generate folded detail data. S2. Based on the query requirements, obtain the dimensions from the folded table model and construct the dimension order sequence. Based on the dimension order sequence, convert the folded detail data into a multi-level hash table structure for storage. S3. Set an operation identifier for each dimension, construct a combined table structure based on the folded table model and the hash table structure, and use the combined table structure to render the initial grouped data table. In response to the expansion or collapse of dimensions in the grouped data table, update the combined table structure and re-render the table content; S4. In response to the change operation on the dimension display order of the grouped data table, generate a new dimension order sequence, and re-execute S2 to S3 based on the new dimension order sequence to update the grouped data table.
2. The method for generating a collapsible multi-dimensional grouped data table as described in claim 1, characterized in that, The process of constructing the folded table model and generating folded detail data includes: Based on the determined target dimension fields and metric fields, a dimension information table and a metric information table are generated. The corresponding target dimension fields and target metric fields are retrieved from these tables. The retrieved dimensions are those required for data analysis in the current analysis scenario, and the retrieved metrics are those that can be directly obtained from the fact detail table or calculated for the current dimension. A mapping relationship is established between the target dimension fields and target metric fields and the original fact detail table. Then, the data transformation logic is determined based on the dimension processing method and metric processing method in the dimension information table and metric information table. The data transformation logic in the folded table model is executed to generate folded detail data from the fact detail table. The folded detail data contains detailed data content related to the dimension fields and metric fields of the corresponding folded table model.
3. The method for generating a collapsible multi-dimensional grouped data table as described in claim 1, characterized in that, The construction of a multi-level hash table structure includes: keys are dimension values, values are hash tables, and the hash tables store the hash table structure of the next level dimension and the data information of the current dimension. The hash tables are used to map the hierarchical relationship between dimensions. The lowest level hash table structure is the value of the last dimension in the dimension sequence and the corresponding metric information.
4. The method for generating a collapsible multi-dimensional grouped data table as described in claim 1, characterized in that, Converting folded detail data into a multi-level hash table structure for storage includes: The outermost hash table structure contains two types of key values: first dimension value information and data. The first dimension value information is the specific value of the first dimension field in the dimension sequence in the folded detail data table. Each value corresponds to a record. The corresponding value is the second hash table structure containing the data of the corresponding dimension value. The record with the key value of data stores the folded detail data. All folded detail data objects are stored in the form of an array. The key values of the innermost hash table structure include two types: the value information of the last dimension and data. Among them, the value information of the last dimension is the value data of the last dimension in the folded detail data table after all previous dimensions take fixed values. Each value corresponds to a record, and the value of this record is the data detail object corresponding to all dimensions taking fixed values. For the record with the key value being data, the value is stored in the form of an array, storing the data detail objects that meet the previous dimension value. The key values of the middle hash table structure include two types: the value information of the Mth layer dimension and data. Among them, the value information of the Mth layer dimension is the value information of the Mth layer dimension in the corresponding folded detail data after the first M - 1 dimensions in the dimension sequence take corresponding values. The corresponding value is the hash table structure of the (M + 1)th layer. For the record with the key value being data, the value stores the data detail objects corresponding to the first M - 1 dimensions taking corresponding values, where 1 < M < N, and N is the number of dimensions in the dimension sequence.
5. The method for generating a collapsible multi-dimensional grouped data table as described in claim 1, characterized in that, The construction of the combined table structure based on the folded table model and the hash table structure includes: Taking the dimensions and measures in the folded table model as the table headers of the combined table, and sorting the dimensions according to the dimension sequence. Initializing the data content of the combined table structure: expanding the data content of the first dimension, and the number of data entries is the number of values of the first dimension. The data value of the first dimension is the value of the first dimension, and the data of other dimensions is the status flag. The value of each row's measure field is obtained by traversing the array object corresponding to data in the hash table structure of the next dimension and summing the corresponding fields. If the measure field is a derived measure field, it is calculated from the corresponding original field according to the measure field calculation rule.
6. The method for generating a collapsible multi-dimensional grouped data table as described in claim 1, characterized in that, In response to the dimension expansion operation on the grouped data table, updating the combined table structure and re - rendering the table content includes: Selecting the target row in the grouped data table and changing the status of the target dimension to expanded. According to the hash table structure, adding multiple data corresponding to the target dimension to the combined table structure. The newly added data is the number of data entries with the key being the dimension value in the hash table structure corresponding to the target dimension. The value of each specific measure field of each data entry is obtained by traversing the data object corresponding to the data column in the next - level hash table structure and summing the corresponding columns. If there is no next - level hash table structure, the corresponding field data of the stored object in the value column is added to the combined table structure. Deleting the original selected and expanded row data from the combined table structure, and adding a fold status flag to the value corresponding to the upper - level dimension of the expanded dimension. Re - rendering the table according to the changed combined table structure, and merging the tables with the same dimension values to form a new grouped data table.
7. The method for generating a collapsible multi-dimensional grouped data table as described in claim 1, characterized in that, In response to the dimension folding operation on the grouped data table, updating the combined table structure and re - rendering the table content includes: Selecting the fold flag of the target dimension in the grouped data and changing the dimension status flag to folded. Add a new data entry to the combined table structure, set the field value of the current dimension of the collapsed data to the collapse flag, and keep the values of other dimension fields consistent with those before the data was merged; the value of the measure field of the new data is summarized by the corresponding field of the grouped data involved in the collapse operation, summing the measure fields that can be summed, and generating field data for measure fields that are calculated using other fields using the processed fields according to the same logic, and storing the generated new field data into the combined table structure; Remove the original grouped data involved in the folding operation from the combined table structure; The table is re-rendered based on the adjusted combined table structure, and dimension fields with the same content are merged into a single table.
8. A collapsible multi-dimensional grouped data table generation system, characterized in that, include: The configuration management module is used to analyze and process the fact detail tables of different business domains, classify the data fields of the fact detail tables to obtain dimension fields and measure fields, determine the target dimension fields and measure fields according to business requirements, build a folded table model, and generate folded detail data. The hash table structure management module is used to obtain dimensions from the folded table model according to query requirements, construct a dimension order sequence, and convert the folded detail data into a multi-level hash table structure for storage based on the dimension order sequence. The table assembly and rendering module is used to set operation identifiers for each dimension, construct a combined table structure based on the folded table model and the hash table structure, and render the initial grouped data table using the combined table structure. In response to the expansion or collapse of dimensions in the grouped data table, update the combined table structure and re-render the table content; The grouping table structure change module is used to generate a new dimension order sequence in response to a change in the dimension display order of the grouping data table, and to trigger the hash table structure management module and the table assembly and rendering module to reconstruct and render the grouping data table based on the new dimension order sequence.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps in the method for generating a collapsible multidimensional grouped data table as described in any one of claims 1-7.
10. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps in the method for generating a collapsible multi-dimensional grouped data table as described in any one of claims 1-7.