CN115934715A - Tabular construction method of program data structure - Google Patents

Tabular construction method of program data structure Download PDF

Info

Publication number
CN115934715A
CN115934715A CN202211531270.6A CN202211531270A CN115934715A CN 115934715 A CN115934715 A CN 115934715A CN 202211531270 A CN202211531270 A CN 202211531270A CN 115934715 A CN115934715 A CN 115934715A
Authority
CN
China
Prior art keywords
array
data
row
key
dimensional array
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211531270.6A
Other languages
Chinese (zh)
Inventor
陈永胜
徐志良
陈香林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shaoguan Zhonglian Digital Technology Co ltd
Original Assignee
Shaoguan Zhonglian Digital Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shaoguan Zhonglian Digital Technology Co ltd filed Critical Shaoguan Zhonglian Digital Technology Co ltd
Priority to CN202211531270.6A priority Critical patent/CN115934715A/en
Publication of CN115934715A publication Critical patent/CN115934715A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention provides a tabular construction method of a program data structure, which relates to the technical field of computer data structure construction, and is characterized in that a basic table structure corresponding to each basic data type is determined, common data types for computer programming are visually represented in a tabular mode, understanding and reading of the program structure are facilitated, efficiency is improved, and then a multi-dimensional table is obtained by nesting table structures in a parent table and combining to express any data structure with different complexity degrees, so that the data structure is clearly displayed in a tabular mode, error probability of data structure output is low, and understanding and communication are easy.

Description

Tabular construction method of program data structure
Technical Field
The invention relates to the technical field of computer data structure construction, in particular to a tabular construction method of a program data structure.
Background
Combining multiple data types into one data set is the most commonly involved technology in computer program writing, which involves the utilization of different computer languages (such as xml, JSON, etc.), and the data structures of different computer languages are expressed differently.
For example, in the JSON language, computer programmers directly construct a JSON data structure according to JSON grammar handwritten codes in the process of writing codes by using the JSON language, and perform line-by-line segmentation formatting on block codes of the JSON data for easy reading, but the way of directly constructing data by using the handwritten codes has long time consumption, low efficiency and poor sharing performance, and mainly because when the data structure is constructed by using JSON data with large data volume, the computer programmers can repeatedly check and confirm the rationality, consistency and integrity of the data structure for many times due to the unclear data structure, so that the efficiency is low; in addition, the way each computer programmer constructs JSON data structures is different (for example, the same key name, meaning that each person understands is different), so that understanding failure or semantic misunderstanding occurs when data sharing is performed. How to quickly construct a complex data structure to achieve the purposes of easy definition, easy reading, easy maintenance and easy propagation is a technical problem to be solved urgently.
In the prior art, a scheme of a method and a device for data format conversion is disclosed, in the scheme, firstly, a user configures or reads other APIs by manual input to construct a dictionary, and the dictionary has certain requirements: the method comprises the steps of forming mapping pairs which must contain two attributes, then constructing a dictionary which contains one element and has mapping relations to generate columns of a two-dimensional table (defining several dictionaries, generating several columns), wherein display names in the mapping relations are column names, and the first column is a row identification column; secondly, operation types (including single filling, single selection, multiple filling, multiple selection and mapping) are preset for each column according to the content attributes filled in the content column, data types corresponding to different operation types are different from a JSON data structure obtained finally, after the setting is finished, a user inputs relevant content of the column according to actual needs, and finally, the corresponding JSON content is obtained according to the operation types and the data types of the column by utilizing an analysis program, so that data of the JSON structure is generated. However, the scheme only realizes that a JSON data structure is defined in a single table mode, the function is single, related dictionaries are required to be built, binding is carried out on the dictionaries and columns of the tables, operation types are determined, a two-dimensional table is built and contents are input, then the two-dimensional table is converted into a standard JSON data structure through a built-in method according to the built-in two-dimensional table, for non-technical personnel, a certain data structure basis is still needed for building JSON data, and for professional programming technical personnel, the JSON data structure is too complex. In addition, the method has poor universality, the JSON data structure can be created only through one two-dimensional table, the JSON data structure is relatively fixed based on the curing property of the two-dimensional table, an arbitrary JSON data structure cannot be constructed, the table is only realized aiming at the outermost layer structure of the JSON data structure, the table content display is incomplete, the content forms displayed by the two-dimensional table are all Chinese names (namely display names) and JSON values, and the code names still need to be checked through a dictionary.
Disclosure of Invention
In order to solve the problems of low efficiency and unclear structure of the current data structure construction mode, the invention provides a tabular construction method of a program data structure, which outputs the data structure in a tabular mode, is visual and efficient, has clear structure, low error probability of data structure output and is convenient to understand and communicate.
In order to achieve the technical effects, the technical scheme of the invention is as follows:
a method of tabular building of program data structures, the method comprising the steps of:
s1, determining a basic table structure corresponding to each basic data type;
s2, according to the data type required to be constructed, selecting a corresponding basic table structure as a parent table, dynamically constructing an html element code, and nesting a table structure corresponding to the corresponding data type in the parent table according to the data type in the data structure;
s3, extracting element codes of the table structure, gradually traversing the table elements from outside to inside, and constructing an array structure of the table;
and S4, traversing all the sub-items in the array structure layer by layer, creating an object or an array, and obtaining a data structure or program data of the program.
According to the technical scheme, the basic table structure corresponding to each basic data type is determined, the data types commonly used for computer programming are visually represented in a tabular mode, understanding and reading of program structures by technicians or non-technicians are facilitated, efficiency is improved, and then the table structures are nested in the parent item table to combine to obtain the multi-dimensional table so as to express any data structures with different complexity degrees, so that the data structures are further clearly displayed in a tabular mode, the error probability of data structure output is low, and understanding and communication are easy.
Preferably, the data types in step S1 include: a key value object, a one-dimensional array, and a two-dimensional array.
Preferably, when the data type is a key-value object, the corresponding basic table structure is represented by a multi-row and two-column sub-table, each row represents a key-value pair of the object, wherein the first input box of the row maps a key of a code, the Chinese name of the key is recorded in the input box, and the related detailed description of the key is recorded in a hidden field; the second entry box of a row maps the value of a key, which is a string, number, object, or array of characters.
The Chinese name and the related detailed description of the key can be synchronously displayed in the code point input box of the table, and the structure can be better understood and read by technicians or non-technicians.
Preferably, when the data type is a one-dimensional array, the corresponding basic table structure is represented by two rows and multiple columns of sub-tables, wherein the first row is a title row, each column of the first row is sequentially mapped with subscript codes of the array, and the subscript of the array and the corresponding Chinese name are noted in each column so as to clarify the meaning of the defined array; the second row maps the input values of the one-dimensional array, which are strings, numbers, pairs or arrays.
Preferably, when the data type is a two-dimensional array, the corresponding basic table structure is represented by a plurality of rows and columns of sub-tables, the first row is a title row, each row of the first row is sequentially mapped with the subscript code number of the array, and the subscript of the array and the corresponding Chinese name are noted in each row so as to clarify the meaning of the defined array; the number of rows in the table can be increased infinitely, the second row and the newly added row are used for recording the value of the two-dimensional array, and each row corresponds to a one-dimensional array value which forms the two-dimensional array from the second row according to the row sequence, and the value of the one-dimensional array value is a character string, a number, an object or an array.
Preferably, the data types required to be constructed in step S2 include: the method comprises the steps that a key value object, a one-dimensional array and a two-dimensional array are selected, a corresponding basic table structure is selected as a parent table according to a data type required to be created, html element codes are dynamically constructed respectively according to the data type required to be created in an input box of the parent table, and the html element codes are nested in the input box of the parent table to obtain a nested table of a corresponding program data structure.
Compared with the problem of single structure in the existing scheme, any program data structure can be constructed based on three basic table structures through table nesting, and full-table format expression of the program data structure is realized.
Preferably, in step S3, the table elements are traversed layer by layer from outside to inside, and the process of constructing the array structure of the nested structure is as follows:
s31, acquiring a data type corresponding to the current parent item table, and determining whether the program type is a key value object, a one-dimensional array or a two-dimensional array;
s32, continuously searching whether the lower level of nesting exists or not, and constructing an array format of a nesting structure as follows: [ 'key id', 'key name', 'type', 'description', 'default', 'style', 'event', [ lower structure ] ];
s33, executing the steps S31-S32 according to the table hierarchical sequence from outside to inside until traversal is completed, and obtaining the final array structure of the nested table.
Preferably, in step S4, traversing all sub-item structures in the array layer by layer, starting from the obtained structure type, creating an object or an array, creating a key-value pair when the object is an object, creating each item of the array when the array is an array, repeating the above operations when the next item is still an object or an array, and finally obtaining a data structure consistent with the array structure.
The array structure obtained here is for recording and storing information of the table structure, and the data structure is the content of the table input.
Preferably, after step S3, the method further comprises: based on the array structure of the built nested table, calling the needed event method to form a program data table structure, then filling the program data value into the table, calling the event method to generate the program data according to the filled program data value, and the specific process is as follows:
extracting a program code structure in a form, traversing layer by layer in a nested form element, firstly acquiring a data type of a current form, confirming whether the data type is a key value object, a one-dimensional array or a two-dimensional array, creating a corresponding data object, and directly taking out a value filled in the form and assigning the value to a current key when a lower level does not exist; when the table is a nested table, the object value of the lower level is taken out by traversing and is assigned to the current key.
The operation is to construct program data, the program data comprises a program data structure, and the method not only supports tabular construction from zero, but also supports direct reference of a tabular structure template, namely, the tabular structure exists, but no content exists in a table input box, and the structure can be modified again on the basis of application. In practical application, if a plurality of API interfaces are defined, the structures of the application of the method parameters are approximately the same, so that the same structure is not required to be defined again every time an interface is defined, and the original defined structure can be directly applied.
Preferably, the tabular transformation construction is performed on the currently existing program structure, and the process is as follows:
converting the current existing program structure code into a memory object, traversing the object layer by layer, deconstructing and acquiring a data type, and constructing a structure array format according to whether the data type is a key value object, a one-dimensional array or a two-dimensional array and whether a lower structure exists or not as follows: [ 'key id', 'key name', 'type', 'description', 'default', 'style', 'event', [ lower structure array ] ];
after traversing, obtaining a final structure array;
traversing the finally formed structure array, and constructing a table structure code according to the structure type key value object, the one-dimensional array and the 3 data types of the two-dimensional array, wherein the object table is constructed into a transverse two-column multi-row sub-table structure, the one-dimensional array is constructed into a vertical two-row multi-column sub-table structure, the two-dimensional array is constructed into a vertical multi-row multi-column sub-table structure, and finally, a nested table structure is constructed to realize the tabulation of the existing program structure.
Compared with the prior art, the technical scheme of the invention has the beneficial effects that:
the invention provides a tabular construction method of a program data structure, which comprises the steps of firstly determining a basic table structure corresponding to each basic data type, visually representing the data type commonly used for computer programming in a tabular mode, facilitating understanding and reading of the program structure, improving the efficiency, then embedding a table structure in a parent table, and combining to obtain a multi-dimensional table to express any data structure with different complexity, thereby further clearly displaying the data structure based on the tabular mode, having low error probability of data structure output and being easy to understand and exchange.
Drawings
FIG. 1 is a flowchart showing a tabular construction method of a program data structure proposed in embodiment 1 of the present invention;
FIG. 2 is a diagram illustrating a basic table structure represented by a plurality of rows and two columns of sub-tables when the data type is a key-value object according to embodiment 1 of the present invention;
fig. 3 is a schematic diagram illustrating a basic table structure represented by two rows and multiple columns of sub-tables when the data type is a one-dimensional array according to embodiment 1 of the present invention;
FIG. 4 is a diagram illustrating a basic table structure represented by a multi-row and multi-column sub-table when the data type is a two-dimensional array according to embodiment 1 of the present invention;
fig. 5 is a diagram illustrating a nested table structure of a multi-dimensional table obtained by combining nested table structures in a parent table according to embodiment 1 of the present invention;
fig. 6 is a schematic interface diagram of a platform content editing area proposed in embodiment 2 of the present invention;
fig. 7 is a diagram showing a json table of definitions proposed in embodiment 2 of the present invention;
FIG. 8 is a diagram illustrating the formation of a program data table structure with program values based on the array structure of the defined nested tables as set forth in embodiment 3 of the present invention;
fig. 9 is a schematic diagram of a table structure created for an existing json structure or data according to embodiment 4 of the present invention.
Detailed Description
The drawings are for illustrative purposes only and are not to be construed as limiting the patent;
for better illustration of the present embodiment, certain parts of the drawings may be omitted, enlarged or reduced, and do not represent actual dimensions;
it will be understood by those skilled in the art that certain descriptions of well-known structures in the drawings may be omitted.
The technical scheme of the invention is further explained by combining the drawings and the embodiment;
the positional relationships depicted in the drawings are for illustrative purposes only and are not to be construed as limiting the present patent;
example 1
As shown in fig. 1, the present embodiment provides a tabular construction method of a program data structure, including the following steps:
s1, determining a basic table structure corresponding to each basic data type;
s2, according to the data type required to be constructed, selecting a corresponding basic table structure as a parent table, dynamically constructing an html element code, and nesting a table structure corresponding to the corresponding data type in the parent table according to the data type in the data structure;
s3, extracting element codes of the table structure, gradually traversing the table elements from outside to inside, and constructing an array structure of the table;
and S4, traversing all the sub-items in the array structure layer by layer, creating an object or an array, and obtaining a data structure or program data of the program.
The embodiment firstly determines a basic table structure corresponding to each basic data type, intuitively represents the data type commonly used for computer programming in a tabulation mode, is beneficial to understanding and reading a program structure by technicians or non-technicians, improves the efficiency, and then obtains a multi-dimensional table by nesting table structures in a parent table and combining the table structures to express any data structure with different complexity, thereby further clearly displaying the data structure in a tabulation-based mode, having low error probability of data structure output and being easy to understand and communicate.
In different computer languages, the data structures are expressed differently, such as xml, json, and the like, in this embodiment, json data is taken as an example, but not limited to json data construction, and xml data and other similar data structures that are required to be used in the field of computers can be constructed similarly. Any complex data structure basically comprises three basic data types: a key value object, a one-dimensional array, and a two-dimensional array; when the data type is a key value object, as shown in fig. 2, the corresponding basic table structure is represented by a plurality of rows and two columns of sub-tables, each row represents a key value pair of the object, wherein, the first input box of the row maps a key of a code, the Chinese name of the key is recorded in the input box, and the related detailed description of the key is recorded in the hidden field, which is more beneficial for technical personnel or non-technical personnel to understand and read the structure, such as product number; the second entry box of a row maps the value of a key, which is a string, number, object, or array, such as xj-001.
As shown in fig. 3, when the data type is a one-dimensional array, the corresponding basic table structure is represented by two rows and multiple columns of sub-tables, wherein the first row is a title column, such as "login user", "ip address" and "login time", each column of the first row maps subscript numbers of the array, such as [0], [1] and [2], and each column is annotated with a chinese name corresponding to the subscript of the array, so as to clarify the meaning of the defined array; the second row maps the input values of the one-dimensional array, which are character strings, numbers, pairs or arrays.
As shown in fig. 4, when the data type is a two-dimensional array, the corresponding basic table structure is represented by a plurality of rows and columns of sub-tables, the first row is a title column, such as "production line", "product number", and "production state", each column of the first row is mapped with subscript numbers of the array, such as [0], [1], and [2], and each column is annotated with a chinese name corresponding to the subscript of the array, so as to clarify the meaning of the defined array; the number of rows in the table can be increased infinitely, the second row and the newly added row are used for recording the value of the two-dimensional array, and each row corresponds to a one-dimensional array value which forms the two-dimensional array from the second row according to the row sequence, and the value of the one-dimensional array value is a character string, a number, an object or an array.
On the basis of the basic table structure, if an input value in a table is an object, or a one-dimensional array, or a two-dimensional array, the same table corresponding to a value type may be nested in an input box of a parent table, where the data types to be constructed in step S2 include: the method comprises the steps that a key value object, a one-dimensional array and a two-dimensional array are selected, a corresponding basic table structure is selected as a parent table according to a data type required to be created, html element codes are dynamically constructed respectively according to the data type required to be created in an input box of the parent table, and the html element codes are nested in the input box of the parent table to obtain a nested table of a corresponding program data structure.
Here, based on three basic table structures, an arbitrary program data structure can be constructed by nesting tables, and taking the example shown in fig. 5, the table as a parent table in fig. 5 is a basic table structure with 4 rows and 2 columns, the first column in the basic table structure is "business name", "business id", "employee" and "department structure", and the second column is sequentially the value corresponding to the first column, wherein one basic table structure is nested in the input boxes corresponding to "employee" and "department structure", respectively, the basic table structure is also nested in the nested basic table structure, and all contents realize the full-table format expression of the program data structure, and are apparent through the table structure instead of coding.
In practical application, the method provided in this embodiment is implemented by entering an editing interface of a platform, as shown in fig. 6, binding various event methods required by each function key of an editing apparatus to define a json table in a content editing area, and tabulating the json table with a purpose of clearly expressing a json structure, in this step, dynamically constructing html element codes to form corresponding tables according to data types required to be created by a content input box, so as to obtain the json table shown in fig. 7, and then translating the defined json table into a group of code structures, which serve as storage information of a table structure, so as to be used in the future, where the json table and the defined json table can be converted into each other by an event method, and in this process, the following steps are performed:
the table elements are traversed layer by layer from outside to inside, and the process of constructing the array structure of the nested structure is as follows:
s31, acquiring a data type corresponding to the current parent item table, and determining whether the program type is a key value object, a one-dimensional array or a two-dimensional array;
s32, continuously searching whether the lower level of nesting exists or not, and constructing an array format of a nesting structure as follows: [ 'key id', 'key name', 'type', 'description', 'default', 'style', 'event', [ lower structure ] ];
s33, executing the steps S31-S32 according to the table hierarchical sequence from outside to inside until traversal is completed, and obtaining the final array structure of the nested table: [ 'JSON structure id', 'JSON structure name', 'JSON structure type', 'JSON load event', [ JSON data structure array ] ], specifically:
<xnotran> [ "", "", "3238 zxft 3238", "", [ [ "User", "", "3262 zxft 3262", "", "", "", "", [ [ "UserName", "", "sw", "", "", "", "", "" ], [ "UserID", " id", "sw", "", "", "", "", "" ] ] ], [ "WorkExper", " ", "ab", "", "", "", "", [ [ "0", "", "sw", "", "", "", "", "" ], [ "1", "", "sw", "", "", "", "", "" ] ] ], [ "Department", "", "aa", "", "", "", "", [ [ "0", " id", "sw", "", "", "", "", "" ], [ "1", " ", "sw", "", "", "", "", "" ] ] ] ] ] </xnotran>
And finally defining a json structure in a tabular mode, traversing all sub-item structures in the array layer by layer, creating an object or an array from the acquired structure type, creating a key value pair when the object is the object, creating each item of the array when the array is the array, repeating the operation when the next item is still the object or the array, and finally obtaining a data structure consistent with the array structure as follows:
{
"User":{
"UserName":"",
"UserID":""
},
"WorkExper":["",""],
"Department":["",""]
}
example 2
This embodiment mainly realizes: and calling the defined tabular json structure to output the json data.
Acquiring a defined json table structure code, calling an event to form a json table structure shown in a right figure 7, calling a required event method based on an array structure of a built nested table to form a program data table structure, then filling a program data value into the table, and calling the event method to generate program data according to the structure of the filled json program data value shown in figure 8, wherein the specific process is as follows:
extracting a program code structure in a form, traversing layer by layer in a nested form element, firstly acquiring a data type of a current form, confirming whether the data type is a key value object, a one-dimensional array or a two-dimensional array, creating a corresponding data object, and directly taking out a value filled in the form and assigning the value to a current key when a lower level does not exist; when the table is a nested table, the object value of the lower level is taken out in a traversal mode and is assigned to the current key, and the final formed object and value are as follows:
{
"User":{
"UserID":"sc01-0001",
"UserName": zhang III "
},
"WorkExper" [ "Producer", "2017-08-03-to-date" ] ],
"Department" [ "sc01", "group of producers" ]
}
The method not only supports the tabular construction structure from zero, but also supports the direct reference of the tabular structure template, namely, the tabular structure exists but no content exists in the table input box, and the structure can be modified on the basis of application. In practical application, if a plurality of API interfaces are defined, the structures of the application of the method parameters are approximately the same, so that the same structure is not required to be determined again every time an interface is defined, and the original defined structure can be directly applied.
Example 3
This embodiment mainly realizes: according to the existing json structure or json data, a corresponding table structure is created, firstly, a standard json data structure is copied or directly input into the json structure through a special input device, and the standard json data structure is set as follows:
{
"User":{
"UserName":"",
"UserID":""
},
"WorkExpe":["",""],
"Department":["",""],
"sw2":["",""]
}
and according to the input standard json data structure, calling an event method and translating the event method into a corresponding tabular json structure. Performing tabular transformation construction on the current existing program structure, wherein the process comprises the following steps:
converting the current program structure code into a memory object, traversing the object layer by layer, deconstructing and acquiring a data type, and constructing a structure array format according to whether the data type is a key value object, a one-dimensional array or a two-dimensional array and whether a lower structure exists or not as follows: [ 'key id', 'key name', 'type', 'description', 'default', 'style', 'event', [ lower structure array ] ];
after traversing, obtaining a final structure array;
traversing the finally formed structure array, constructing a table structure code according to the structure type key value object, the one-dimensional array and the 3 data types of the two-dimensional array, wherein the object table is constructed into a transverse two-column multi-row sub-table structure, the one-dimensional array is constructed into a vertical two-row multi-column sub-table structure, the two-dimensional array is constructed into a vertical multi-row multi-column sub-table structure, and finally, constructing a nested table structure as shown in fig. 9 to realize the formatting of the existing program structure.
It should be understood that the above-described embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. Other variations and modifications will be apparent to persons skilled in the art in light of the above description. This need not be, nor should it be exhaustive of all embodiments. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the claims of the present invention.

Claims (10)

1. A method for tabular building of program data structures, the method comprising the steps of:
s1, determining a basic table structure corresponding to each basic data type;
s2, according to the data type required to be constructed, selecting a corresponding basic table structure as a parent table, dynamically constructing an html element code, and nesting a table structure corresponding to the corresponding data type in the parent table according to the data type in the data structure;
s3, extracting element codes of the table structure, gradually traversing the table elements from outside to inside, and constructing an array structure of the table;
and S4, traversing all the sub-items in the array structure layer by layer, creating an object or an array, and obtaining a data structure or program data of the program.
2. The method of claim 1, wherein the data types in step S1 include: a key value object, a one-dimensional array, and a two-dimensional array.
3. The method of claim 2, wherein when the data type is a key-value object, the corresponding basic table structure is represented by a multi-row and two-column sublist, each row representing a key-value pair of the object, wherein a first input box of a row maps a key of the code, records a chinese name of the key in the input box, and records an associated detailed description of the key in the hidden field; the second entry box of a row maps the value of a key, which is a string, number, object, or array of characters.
4. The method of claim 2, wherein when the data type is a one-dimensional array, the corresponding basic table structure is represented by two rows and a plurality of columns of sub-tables, wherein the first row is a title column, each column of the first row is sequentially mapped with the subscript number of the array, and the subscript of the array and the corresponding Chinese name are noted in each column to clarify the meaning of the defined array; the second row maps the input values of the one-dimensional array, which are character strings, numbers, pairs or arrays.
5. The method of claim 2, wherein when the data type is a two-dimensional array, the corresponding basic table structure is represented by a plurality of rows and columns of sub-tables, the first row is a title column, each column of the first row is sequentially mapped with the subscript number of the array, and the subscript of the array and the corresponding Chinese name are noted in each column to clarify the meaning of the defined array; the number of rows in the table can be increased infinitely, the second row and the newly added row are used for recording the value of the two-dimensional array, and each row corresponds to a one-dimensional array value which forms the two-dimensional array from the second row according to the row sequence, and the value of the one-dimensional array value is a character string, a number, an object or an array.
6. The method of claim 2, wherein the data types to be constructed in step S2 include: the method comprises the steps that a key value object, a one-dimensional array and a two-dimensional array are selected, a corresponding basic table structure is selected as a parent table according to a data type required to be created, html element codes are dynamically constructed respectively according to the data type required to be created in an input box of the parent table, and the html element codes are nested in the input box of the parent table to obtain a nested table of a corresponding program data structure.
7. The method of claim 6, wherein in step S3, the table elements are traversed layer by layer from outside to inside, and the process of constructing the array structure of the nested structure is as follows:
s31, acquiring a data type corresponding to the current parent item table, and determining whether the program type is a key value object, a one-dimensional array or a two-dimensional array;
s32, continuously searching whether the lower level of nesting exists or not, and constructing an array format of a nesting structure as follows: [ 'key id', 'key name', 'type', 'description', 'default', 'style', 'event', [ lower structure ] ];
s33, executing the steps S31-S32 according to the table hierarchical sequence from outside to inside until traversal is completed, and obtaining the final array structure of the nested table.
8. The method of claim 7, wherein in step S4, the structure of all sub-items in the array is traversed layer by layer, starting with the obtained structure type, an object or array is created, when the object is an object, a key-value pair is created, when the array is an array, each item in the array is created, and when the next item is still an object or array, the above operations are repeated, and the resulting data structure is consistent with the array structure.
9. The method of tabulating a program structure according to claim 2, further comprising, after step S3: based on the array structure of the built nested table, calling the needed event method to form a program data table structure, then filling program data values into the table, calling the event method to generate program data according to the filled program data values, and the specific process is as follows:
extracting a program code structure in a form, traversing layer by layer in nested form elements, firstly obtaining a data type of a current form, confirming whether the data type is a key value object, a one-dimensional array or a two-dimensional array, creating a corresponding data object, and directly taking out values filled in the form and assigning the values to a current key when a lower level does not exist; when the table is a nested table, the object value of the lower level is taken out by traversing and is assigned to the current key.
10. The method of claim 2, wherein the tabular transformation building is performed on a currently existing program structure by a process comprising:
converting the current existing program structure code into a memory object, traversing the object layer by layer, deconstructing and acquiring a data type, and constructing a structure array format according to whether the data type is a key value object, a one-dimensional array or a two-dimensional array and whether a lower structure exists or not as follows: [ 'key id', 'key name', 'type', 'description', 'default', 'style', 'event', [ lower structure array ] ];
after traversing is completed, a final structure array is obtained;
traversing the finally formed structure array, and constructing a table structure code according to the structure type key value object, the one-dimensional array and the 3 data types of the two-dimensional array, wherein the object table is constructed into a transverse two-column multi-row sub-table structure, the one-dimensional array is constructed into a vertical two-row multi-column sub-table structure, the two-dimensional array is constructed into a vertical multi-row multi-column sub-table structure, and finally, a nested table structure is constructed.
CN202211531270.6A 2022-12-01 2022-12-01 Tabular construction method of program data structure Pending CN115934715A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211531270.6A CN115934715A (en) 2022-12-01 2022-12-01 Tabular construction method of program data structure

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211531270.6A CN115934715A (en) 2022-12-01 2022-12-01 Tabular construction method of program data structure

Publications (1)

Publication Number Publication Date
CN115934715A true CN115934715A (en) 2023-04-07

Family

ID=86648595

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211531270.6A Pending CN115934715A (en) 2022-12-01 2022-12-01 Tabular construction method of program data structure

Country Status (1)

Country Link
CN (1) CN115934715A (en)

Similar Documents

Publication Publication Date Title
KR102058124B1 (en) A system for adding deep-learning forecaset data by using an OLAP data with pivot table
CN101661512B (en) System and method for identifying traditional form information and establishing corresponding Web form
US7680333B2 (en) System and method for binary persistence format for a recognition result lattice
US8577652B2 (en) Spreadsheet-based graphical user interface for dynamic system modeling and simulation
US8117217B2 (en) Information processing apparatus and encoding method
CN110738037A (en) Method, apparatus, device and storage medium for automatically generating electronic form
CN111309313A (en) Method for quickly generating HTML (hypertext markup language) and storing form data
CN108446313B (en) Data format conversion method and device
CN112579086B (en) Template construction method adaptive to multi-platform front-end View
US9646004B2 (en) Hierarchical database report generation with automated query generation for placeholders
CN116468010A (en) Report generation method, device, terminal and storage medium
CN115935944A (en) Cross-platform standard file tree structure generation method and display control
CN113535977A (en) Knowledge graph fusion method, device and equipment
CN110929494A (en) Method for generating report drop-down box based on hierarchical tree
CN116821103B (en) Data processing method, device, equipment and computer readable storage medium
CN114207598A (en) Electronic form conversion
CN115934715A (en) Tabular construction method of program data structure
WO2021012499A1 (en) File comparison method and apparatus, computer device and storage medium
CN115934716A (en) Method for importing Excel table data into database based on metadata definition and implementation
CN113536041B (en) Method for rapidly acquiring railway engineering geographic information metadata in batches
JPH04278634A (en) Tree growth system and method
CN115630086B (en) Method for converting Access application into Web application program
CN111797056B (en) Vectorization family book generation method and vectorization family book generation system
US20240037325A1 (en) Ability to add non-direct ancestor columns in child spreadsheets
CN108536443B (en) Method for automatically and mutually converting net object and multiple data formats based on declarative form

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination